[Mediawiki-l] api.php action=edit problem badtoken

Tim McKenna tim at sitebuilt.net
Sun Jan 31 20:38:44 UTC 2010


Hi,
I went through the sample steps in the API
example<http://www.mediawiki.org/wiki/API:Edit_-_Create%2526Edit_pages#Example>
on using the api to edit a page:

1. login your bot: ( I just used my admin login) - it succeeds
2. get a token - it suceeds
3. post to api.php - this is the form I
use<http://pathboston.com/forms/mw/append21.html>- after I get the
token I replace the +\ with %2B%5C
Alas, I get this error:

<?xml version="1.0"?>
<api>
  <error code="badtoken" info="Invalid token" xml:space="preserve">

my form code is:

<form id="form1" name="Update" method="post"
action="../../hum310/api.php?action=edit">
  <label>title: <input type="text" name="title" id="textfield"
value="Talk:Main_Page" /></label><br />
  <label>section: <input type="text" name="section" id="textfield"
value="new"/></label><br />
  <label>summary: <input type="text" name="summary" id="textfield"
value="Hello%20Worldwide"/></label><br />
  <label>text: <input type="text" name="text" id="textfield"
value="Hello%20everyone!"/></label><br />
  <label>watch: <input type="text" name="watch" id="textfield" /></label><br />
  <label>basetimestamp: <input type="text" name="basetimestamp"
id="textfield" value="2008-03-20T17:26:39Z"/></label><br />
  <label>token: <input type="text" name="token" id="textfield"
value="96a50d37e6c48e6d0def3dd64dc9450d%2B%5C" size=50/></label><br />
<input name="" type="submit" value="send" />
</form>
<a href="http://pathboston.com/hum310/api.php?action=query&prop=info|revisions&intoken=edit&titles=Main%20Page">get
token</a>

Thanks,

Timothy S. McKenna
Humanities teacher
Parkway Academy of Technology and Health, a Boston Public High School
1205 VFW Parkway, Boston, MA 02132 rm404
tim at sitebuilt.net, http://sitebuilt.net
exp. course news on twitter, id: mrtmckenna
class wiki sites:
http://pathboston.com/hum Humanities 3
http://pathboston.com/poets class159
(857)498-2574 (mobile), (617)524-0938 (home)


More information about the MediaWiki-l mailing list