API:Changing wiki content

Posting Data / needs major editPage.php rewrite
 this feature depends on the query token, which is NOT implemented  Need Help At present, user interface code is tightly woven with the database access code, making it unusable for the API. These two must be separated from one another – we need a clean data access layer without any UI logic. If you want to contribute with rewriting EditPage.php, and if you know PHP and MediaWiki, or you think you can learn it, please give us a hand at making this possible. --Yurik 15:07, 17 October 2006 (UTC)

action=submit allows data to be posted back to the MediaWiki servers. For this to work, the client must first obtain an edittoken by using prop=info & intokens=edit query call. Both the lastrev and the token have to be sent to the server, together with the title of the page, its content, and the summary comment. disablemerge parameter stops the save operation in case the article has been modified after the query call. testrun parameter attempts the save operation by merging the content with the newer changes (if needed), and returning how the page would look like if it was saved, but without actually changing any data.

Note: The parameters should be modified to allow for the controlled merge. For example: rev #1 is received, an attempt is made to save changes to it, but rev #2 has been created in the meantime. The client decides to allow merge with rev #2, but while the decision is made, the rev #3 has been published. The client should have the option to only allow merging with rev #2 which was verified, not with rev#3 that it has not yet seen.

Request: api.php ? action=submit & title=Project:articleA & edittoken=abc123 & revid=12345 & summary=edit_comment & content=wikitext [& minorEdit] [& disablemerge] [& testrun] Result: api: save: status: Success            Other values: 'Prohibited', 'Conflict', 'DbLocked', 'BadToken', 'MergeRequired' (for the testrun: 'CanMerge', 'CanSaveAsIs'       title: Wikipedia:ArticleA   Always returns normalized title       ns: 4                       Show title's namespace except when ns=0       id: 12345                   On success, the ID of the page       revid: 67891                On success, the new latest revision id       redirect:                   On success, when saved page is now treated as a redirect       content: wiki content       When used with testrun'', this field will be set to the merge result

Uploading
Multipart post request: api.php ? action=upload & upfilename=Filename & upsummary=Summary [& upwatch] [& upignore] [& uplicense=License] Response: status: Success            Other values: 'Prohibited', 'Overwritten', 'DbLocked', 'FileExists' title: Image:Filename.jpg  Always returns normalized title ns: 6                      Show title's namespace except when ns=0 id: 12345                  On success, the ID of the page revid: 67891               On success, the new latest revision id

Creating new User Accounts
Request parameters will be passed via POST to protect sensible information.

Request api.php ? action=reguser & runame=Name & rupassword=Password [& rudomain=Domain] [& rumail=Mail@Mail.com]

Response: api: regUser: result: Success           Other values: Exists, Blocked, ReadOnly, BadToken, NoName, EmptyPass rutoken: 123ABC           Also returned as a cookie ruusername: UserName      Normalized runame, also returned as a cookie ruuserid: 12345           Also returned as a cookie