API talk:Edit

Dear early adopters, does the edit action work for anyone? I try hard but can't get it to work with an php client. Like suggested at the login-discussion site i now use the Snoopy library to set the cookies for the mw system (hopefully this is not necessary anymore in the near future!). I am able to login and to request a edit-token. but if i try to edit the content, i get the result Conflict detected. Is it possible to get some more details about the conflict? Any logfiles or something else which could help?
 * Ah, found the conflict myself: i was using the false epedittime. Now it works!

Create pages
How do I need to change the code in order to create, rather than edit, a page? Thanks.

Sorry for the late response. Create and edit are the same from the API point of view. eptext=WikiText parameter is the whole article content, including changes when the article has been edited, or new content when eptitle did not exist. --Raquel.Frisa 10:07, 19 October 2007 (UTC)


 * one little difference would be useful: sometimes you want to change an article only if it exists, but not create it if it doesn't. an example: inserting a speedy-deletion-template should not recreate an already deleted article. -- ∂ 01:48, 21 October 2007 (UTC)
 * What about you just check for the article's existence using api.php?action=query&prop=info&titles=hddfal? --Catrope 12:26, 21 October 2007 (UTC)
 * Race condition -- ∂ 15:03, 25 October 2007 (UTC)
 * You'll get an w:Wikipedia:Edit conflict, won't you? --Catrope 22:16, 30 October 2007 (UTC)
 * that would only be possible if i fetched the edittoken before the article has been deleted, and there's no way to ensure that. -- ∂ 13:35, 5 November 2007 (UTC)
 * True. There should probably be an epNoCreate parameter. --Catrope 15:08, 5 November 2007 (UTC)

Can't pass &prop via php
$titleURL = "action=query&prop=info&titles=BatPresubmitTest&intoken=edit&lgtoken=". $getLoginResponse['login']['lgtoken']."&lgusername=". $getLoginResponse['login']['lguseprname']."&lguserid=". $getLoginResponse['login']['lguserid']. "&format=php";

$getTitleResponse = unserialize(getURL($apiURL,$titleURL)); function getURL($url,$vars){ $ch = curl_init; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch,CURLOPT_POSTFIELDS,$vars); $content = curl_exec($ch); curl_close($ch); return $content; } No matter how I try this &prop gets encodes to &#8733; Does anyone have a clue how to that parameter without the param getting encoded/decoded to a char? --jason 04:08, 13 November 2007 (UTC)
 * That's weird. You could:
 * Try to use &amp; rather than &
 * Use Snoopy, which doesn't have this problem (and allows you to specify post data as an array instead).
 * --Catrope 14:25, 13 November 2007 (UTC)
 * Thanks - Solved with this (apparently tokens arent working - go snoopy)
 * --jason 18:03, 13 November 2007 (UTC)

function getSnooped($url,$vars){ include "Snoopy.class.php"; $snoopy = new Snoopy; $snoopy->cookies["inside_wikiToken"] = $_COOKIE["inside_wikiToken"]; $snoopy->cookies["inside_wikiUserID"] = $_COOKIE["inside_wikiUserID"]; $snoopy->cookies["inside_wikiUserName"] = $_COOKIE["inside_wikiUserName"]; $snoopy->cookies["inside_wiki_session"] = $_COOKIE["inside_wiki_session"]; $snoopy->submit($url,$vars); $snoopy->setcookies; return $snoopy->results; }

Odd - is this enabled?
Maybe I'm missing something -- heck, I probably am :)

Say, I try a request like this:

Array (   [epedittoken] => 3b70467f9655b80195b13e7765437dc0+\    [epsummary] => SxWiki: Testing    [eptext] => New revision here    [lgtoken] =>     [minoredit] => no    [epuserid] => 4746784    [testrun] => no    [disablemerge] => no ) I'm trying to send it to this URL: http://en.wikipedia.org/w/api.php?action=edit&title=User%3ASQL%2FSandbox

No matter what I do, I get:

unknown_action: Unrecognised value for parameter 'action' 1.13: Still same problem - User:Dynasource
 * Did you remember to add  to LocalSettings.php? --77.164.182.8 17:52, 9 August 2008 (UTC)

Anyone know what the likely obvious thing I'm missing is? :) SQL Query me!  04:14, 15 November 2007 (UTC)
 * This is a proposed implementation that's only partially been written and is not yet available in the main source tree. It will be when it's been completed and tested. --Catrope 13:37, 15 November 2007 (UTC)


 * Gotcha, maybe the article should say so :) SQL Query me!  21:19, 15 November 2007 (UTC)

Just out of interest does anyone have an idea about when this is likely to be implemented, or what we can do to speed it up?? :) 84.68.125.79 21:59, 5 December 2007 (UTC)
 * It's gonna be implemented eventually. The Vodafone folks were supposed to be working on this, but have been inactive lately, so I'll take up their work soon. --Catrope 14:20, 6 December 2007 (UTC)

Is there is any update on when would this Edit/Create APIs be ready? Anyone working on this? Also what is it missing to make it work? Maybe we can help making it working...., thanks in advance for the update. --66.131.255.87 03:34, 19 February 2008 (UTC)
 * Action=edit is now finished, but it hasn't been enabled on Wikipedia and friends yet. --Catrope 13:15, 12 March 2008 (UTC)

unknown_action: Unrecognised value for parameter 'action'
I have version 1.12 installed, as well as both API parameters in the LocalSettings set to true; When i make a POST request to edit (action=edit), i am getting this error:  "unknown_action: Unrecognised value for parameter 'action'". Anyone know why I would be getting this? Isn't editing supposed to be supported for version 1.12? --Duke33 19:29, 12 April 2008 (UTC)
 * Oops, that should be 1.13. --Catrope 19:56, 13 April 2008 (UTC)


 * Me too :(
 * Go back, to trying again the parsed method by browsing.
 * --Covi 11:40, 3 May 2008 (UTC)

deadline to enable action=edit on Wikipedia?
If not soon, what method you'd suggest to use meanwhile? -- Григор Гачев 09:20, 14 August 2008 (UTC)
 * I don't think action=edit will be enabled on WMF wikis very soon. To make action=edit cooperate nicely with extensions, a rewrite of EditPage.php should really be done. I've done some of that rewriting already, but it'll take some time. In the meantime, you can use pywikipediabot. --Catrope 12:41, 15 August 2008 (UTC)
 * Sorry, I don't understand: does action=edit actually work but is disabled on Wikipedia, or is it unfinished and impossible to enable on any MediaWiki site? --217.117.119.246 02:16, 17 August 2008 (UTC)
 * action=edit works fine. It hasn't been enabled on WMF wikis (including Wikipedia) yet because it doesn't work too nicely with extensions yet. --Catrope 06:59, 17 August 2008 (UTC)