[Mediawiki-l] MediaWiki API help: cannot get a token after login

Daniel Barrett danb at VistaPrint.com
Wed May 21 14:59:47 UTC 2008


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 &#039;move&#039; 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



More information about the MediaWiki-l mailing list