I'm trying out the MediaWiki API and cannot seem to obtain a token (say, a "move" token) after a successful login. Can anyone help? Here is what I've tried. This is MediaWiki 1.12.0 on Windows 2003 Server (Apache 2.2.8, MySQL 5, PHP 5.2.5).
I do have:
$wgEnableWriteAPI = true;
My script runs on the command line. Login succeeds, giving me a login token, when I POST with these parameters:
api.php?action=login&lgname=tester&lgpassword=123456&format=xml
and get back:
<?xml version="1.0" encoding="utf-8"?> <api> <login result="Success" lguserid="123" lgusername="tester" lgtoken="eedcad0fa714033528290183da251af8" cookieprefix="wikidb_mw_" sessionid="lldh5t86b3vbeccpeda46s5ep6" /> </api>
But when I try to get a Move token via POST:
api.php?action=query&prop=info&intoken=move&titles=my+new+page&lgtoken=eedcad0fa714033528290183da251af8&format=xml
I get:
<?xml version="1.0" encoding="utf-8"?> <api> <error code="inpermissiondenied" info="Action 'move' is not allowed for the current user" /> </api>
Strangely, if I paste the "move token" URL into a web browser, instead of running a script on the command line, I get different results:
<api> <query> <normalized> <n from="my new page" to="My new page"/> </normalized> <pages> <page ns="0" title="My new page" missing=""/> </pages> </query> </api>
but still no Move token.
Any ideas? Thanks! DanB
Same problem happens in 1.13. (I'm using 1.12 below.)
DanB
-----Original Message----- From: mediawiki-l-bounces@lists.wikimedia.org [mailto:mediawiki-l-bounces@lists.wikimedia.org] On Behalf Of Daniel Barrett Sent: Wednesday, May 21, 2008 11:00 AM To: MediaWiki announcements and site admin list Subject: [Mediawiki-l] MediaWiki API help: cannot get a token after login
I'm trying out the MediaWiki API and cannot seem to obtain a token (say, a "move" token) after a successful login. Can anyone help? Here is what I've tried. This is MediaWiki 1.12.0 on Windows 2003 Server (Apache 2.2.8, MySQL 5, PHP 5.2.5).
I do have:
$wgEnableWriteAPI = true;
My script runs on the command line. Login succeeds, giving me a login token, when I POST with these parameters:
api.php?action=login&lgname=tester&lgpassword=123456&format=xml
and get back:
<?xml version="1.0" encoding="utf-8"?> <api> <login result="Success" lguserid="123" lgusername="tester" lgtoken="eedcad0fa714033528290183da251af8" cookieprefix="wikidb_mw_" sessionid="lldh5t86b3vbeccpeda46s5ep6" /> </api>
But when I try to get a Move token via POST:
api.php?action=query&prop=info&intoken=move&titles=my+new+page&lgtoken=eedcad0fa714033528290183da251af8&format=xml
I get:
<?xml version="1.0" encoding="utf-8"?> <api> <error code="inpermissiondenied" info="Action 'move' is not allowed for the current user" /> </api>
Strangely, if I paste the "move token" URL into a web browser, instead of running a script on the command line, I get different results:
<api> <query> <normalized> <n from="my new page" to="My new page"/> </normalized> <pages> <page ns="0" title="My new page" missing=""/> </pages> </query> </api>
but still no Move token.
Any ideas? Thanks! DanB
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Daniel Barrett wrote:
Same problem happens in 1.13. (I'm using 1.12 below.)
DanB
You can probably get better answer by posting to the mediawiki-api mailing list. Although the ones actually able to answer it (likely Roan?) will also be reading this list. There have been changes very recently to how the token asking fails. It's probably unrelated to this problem, but worth noting.
a move token is likely restricted by user rights. Seeing as that the reply contains "permissiondenied", that is probably the cause.
On May 21, 2008, at 1:30 PM, Platonides wrote:
Daniel Barrett wrote:
Same problem happens in 1.13. (I'm using 1.12 below.)
DanB
You can probably get better answer by posting to the mediawiki-api mailing list. Although the ones actually able to answer it (likely Roan?) will also be reading this list. There have been changes very recently to how the token asking fails. It's probably unrelated to this problem, but worth noting.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Darren VanBuren onekopaka@gmail.com ---------------------------------------------- Administrator of Onekopakaspace
Thanks everyone, I didn't know there was a mediawiki-api mailing list. I found my answer in its archives:
https://lists.wikimedia.org/mailman/htdig/mediawiki-api/2007-November/000213...
which indicates that the docs are incorrect (not updated yet).
DanB
-----Original Message-----
You can probably get better answer by posting to the mediawiki-api mailing list.
mediawiki-l@lists.wikimedia.org