API talk:Changing wiki content

From mediawiki.org
Latest comment: 15 years ago by Catrope in topic simple undo?

About save[edit]

Hi everybody. I noticed two things about the "save" action:

  1. shouldn't the request include the time of the last revision of the article? otherwise, how can the server detect an edit conflict?
  2. I think the new content of the page should be passed as a POST request, rather than being embedded in the URL.

Thanks for your attention Paolo Liberatore 10:55, 15 September 2006 (UTC)Reply

Hi Paolo. POST & GET are treated the same, thus it really doesn't matter (except in login, where I migth force data to be sent in the post to avoid leaving logging traces, etc. Here i list them in the GET format just for simplicity sake. As for the saving, you are correct, the edit token will contain the revid of the article being submitted. I just haven't gotten around to spescifying the saving part. Thanks for checking! --Yurik 14:37, 15 September 2006 (UTC)Reply

Note that a POST request is permitted to be much larger than a GET request, and so would be needed for submiting large pages. robchurch | talk 07:11, 14 May 2007 (UTC)Reply

Auto merging/edit conflicts[edit]

I do have some concerns about the merge case. I think the merge process should be made explicit, which means the client should be able to retrieve the would-be-merged result before the save. Which means there should be a conflict detection query. Maybe a session model would be helpful.
Use case A (very rough idea):

  1. The client could say to the server: "Give me the content of page P" (Get(P) returning content)
  2. then "Show me the text of page P that would result if I would save it with content C1 right now (and please tell me if this would need a merge and if yes whether the merge would be successful or not)" (Mergecheck(C1) returning mergeresult)
  3. then "I want to save page P with content C2" (Save(P,C2)).

This would allow to build more editor-like (or browser-like) client apps. --Ligulem 09:12, 17 September 2006 (UTC)Reply

Please take a look at the parameters for the submit request. Is that what you were looking for? --Yurik 13:36, 18 September 2006 (UTC)Reply
Looks good. I think that's it. (sorry for the late reply) --Ligulem 12:06, 22 September 2006 (UTC)Reply

Still need help?[edit]

I've been hacking away at Mediawiki for some time now, mainly writing extensions. Recently though I've returned to working on my perl Mediawiki as VCS project: WWW::Mediawiki::Client. I'd like to streamline it using this API, thus I'm very highly motivated to get the API working as soon as possible. So, do you still want help with this? -- MarkAJaroski 13:23, 2 August 2007 (UTC)Reply

Help is always welcome :) There is a group from Vodaphone actively collaborating on the edit functionality. I am talking to them every day during the Wikimania in Taipei. Several issues need to be resolved: various commit functionality actions (edit, move, protect, etc), and a comprehensive testing framework / tests to make sure no regression bugs are introduced. Please subscribe to the API mailing list and see the development in the next few days of the api editing branch (not created yet). --Yurik 14:37, 2 August 2007 (UTC)Reply

Branch Maintenance[edit]

With two distinct edit branches, who is maintaining them, and are they being maintained separately or in parallel? Also, what about overlap? It seems in everyone's best interest to reduce overlap, but also to make sure that they stay fairly up-to-date with each other. Eddieroger 19:34, 5 November 2007 (UTC)Reply

The branches don't overlap: there is a list here that clearly states which branch implements what. The apiedit branch is maintained by me (Roan Kattouw AKA Catrope) and is pretty much finished, I intend to slowly start merging it with trunk soon. The ApiEdit_Vodafone branch is maintained by the Vodafone people, I don't know exactly who they are (but they have Spanish-sounding names). --Catrope 21:20, 5 November 2007 (UTC)Reply
So what efforts are taken to keep the two in sync with each other? If anyone from the Vodafone branch is skims across this, can they chime in? I suppose as more of apiedit gets merged into trunk, they'll come into sync, but I was wondering if there was conscious effort or just things happening as they do. Thanks. Eddie Roger 00:38, 6 November 2007 (UTC)Reply

I think the most interesting feature is "edit page", which hasn't implemented yet. =(( I have two question regarding this: 1) Is it possible to merge Vodafone code with exsisting MediaWiki sources? Form the first easy try it didn't work. I put ApiEditPage.php and tried to make it work but looks like there is additional dependencies. 2) May be there is an approximate date when this feature will be available?

simple undo?[edit]

I've been looking over these docs for the past hour or so, and I can't quite figure out how to do a simple undo (last edit only, not a rollback of all contiguous edits by a user). is anything like that implemented, and if so, where is it? thanks! --Ludwigs2 01:58, 13 October 2008 (UTC)Reply

There is no way to do an undo as simply as action=rollback, so you'll just have to use prop=revisions&rvprop=content to get the content of the second-to-last revision (the one you want to revert to) and save that text with action=edit. --Catrope 15:29, 13 October 2008 (UTC)Reply
And what about http://www.mediawiki.org/w/index.php?title=Talk:API:Changing_wiki_content&action=edit&undoafter=217957&undo=218017 ? Delhovlyn 14:53, 17 January 2009 (UTC)Reply
That's trickier, but still doable. Basically, you need to get the contents of the undo revision (218017 in your example), the undoafter revision (217957) and the current revision, and do a three-way merge on those. A diff3 program can do this, see the implementation of wfMerge() in GlobalFunctions.php . Of course this should be possible to do in the API too, filed as bug 17051. --Catrope 17:36, 17 January 2009 (UTC)Reply