Last modified: 2014-02-19 13:06:51 UTC
Intention: I wanted to get the edit token of a Wikipedia:Sandbox page to edit it through Codecademy. Steps to Reproduce: 1. I made a tutorial on codecademy for wikipedia API to get the edit token of a Wikipedia:Sandbox page 2. The link to the tutorial is : http://www.codecademy.com/courses/web-intermediate-en-BLea4/4/1 Actual Results: The api is returning a warning saying : "Unrecognized value for parameter 'intoken': edit" Expected Results: There is not a clear message when using a callback parameter while trying to get a token Reproducible: Didn't try
The documentation for the callback parameters includes the sentence "For safety, all user-specific data will be restricted.", this includes also tokens from prop=info, why 'edit' is not a valid value for intoken in that situation. Same for action=tokens.
When you are on a mediawiki page, you can use mw.user.tokens.get('edittoken') to get a token. When you are on a mediawiki page, you can get a token also over mw.api.getToken, have a look at mediawiki.api.js to see, how this module will do it. The following comment was found in that file: // Due to the API assuming we're logged out if we pass the callback-parameter, // we have to disable jQuery's callback system, and instead parse JSON string, // by setting 'jsonp' to false. maybe that helps
Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more clarifications you would like to see in the documentation? If so, what?
(In reply to Andre Klapper from comment #3) > Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more > clarifications you would like to see in the documentation? If so, what? Andre: Yes Umherirrender's comment helped in understanding the problem. As i am not using mediawiki instance so can't use mw.api.getToken. Sorry for replying so late.
(In reply to Diwanshi Pandey from comment #4) > (In reply to Andre Klapper from comment #3) > > Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more > > clarifications you would like to see in the documentation? If so, what? > > Andre: Yes Umherirrender's comment helped in understanding the problem. As i > am not using mediawiki instance so can't use mw.api.getToken. Sorry for > replying so late. I still think there is a (low-priority) bug here, as we shouldn't return a "parameter doesn't exist" error for a "parameter disabled" error. Error messages should reflect their actual causes, otherwise it confuses people.