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'

Anyone know what the likely obvious thing I'm missing is? :) SQL Query me!  04:14, 15 November 2007 (UTC)