API:Changing wiki content

Editing Content
Vodafone R&D has created a new branch, Vodafone_ApiEdit, to add new functionality related to edition and creation of articles, file uploads, at this moment only images, and creation of new user accounts.


 * Edit about the action to create new articles or modify existing ones.
 * Upload about the action to upload files to MediaWiki software like image, audio, video.
 * RegUser about the action to create new user accounts.

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