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)
 * 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;
 * $snoopy->setcookies;

return $snoopy->results; }
 * --jason 18:03, 13 November 2007 (UTC)