API talk:Edit

Edit Action Not Working
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)


 * action=edit seems to be available only from 1.13, i. e. there is a file includes/api/ApiEdit.php
 * I figured it out with help of http://www.markmail.org/message/r5pa4b64dtotpydy, http://www.nabble.com/Trouble-making-edit-requests-td21464948.html and my own installation. I couldn't find it anywhere in the documentation.

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)
 * Is known when it will be activated on the WMF wikis? -- Fale
 * No. --Catrope 14:18, 17 August 2008 (UTC)

internal server error using edit
I´m trying to edit an article on en.wikipedia.org. The response I´m getting from the server seems ok when it returns a code error, like "cantcreate-anon" if the query doesn´t identify the user, "articleexists" if it is trying to create a page that already exists and the createonly parameter is set or "badtoken" if the token is not valid

But when the request seems to be all right I get an Internal Server Error (Http code 500).
 * This was fixed, see also 15420. --Catrope 21:20, 6 September 2008 (UTC)

Strange stuff ?
I've some problems using this editing API: Is there any info about this comportement, do I fortget someting ? I use Mediawiki 1.13.1. Charles 16:39, 5 October 2008 (UTC)
 * All parameters must be send in the url to be understand by the server, but I must use a POST request and fill the content with some dummy data. (why not passing the content of my page in the post?)
 * And the token is not received properly : the final caracter + is replaced with a space, and the token test fails.
 * You should urlencode the token so the  is encoded as  . Also, you shouldn't put dummy data in the POST body; instead, you should set the Content-Type to   and use the query string (e.g.   as the POST body. --Catrope 20:26, 5 October 2008 (UTC)
 * Ok for the urlencode. Stupid question, trivial answer... :-p
 * For the post problem, that's really strange. It works perfectly if I send a POST and send ma datas in the URL... Setting Content-Type to application/x-www-urlencoded changes nothing. URL's length is limited, so I have to fix it. If anybody have a suggestion? Charles 20:14, 6 October 2008 (UTC)
 * Ok, found. you must set content type to application/x-www-form-urlencoded (do not forget the form !). Thnak you for your help! Charles 20:20, 6 October 2008 (UTC)

token clarification
currently, the code for getting an edit token is given as follows:
 * api.php?action=query&prop=info|revisions&intoken=edit&titles=Main%20Page

this raises a question about the use of combined queries like '&prop=info|revisions'. how far can that be extended? is it restricted within general categories, or could we (if it made sense) do, say, a 'prop' and a 'list' command in the same query?

I think for the purposes of the documentation that we should drop the '|revisions' bit, which isn't necessary to get the token and last revision. I'll go ahead and edit that change in (feel free to revert if there's something I'm misunderstanding).

actually, I think there ought to be a 'API Programming Conventions' page that lays out some of these obscure details (like using a vertical bar to separate multiple options or actions, or sending combined requests). maybe combine it with the Formats page? --Ludwigs2 20:23, 14 October 2008 (UTC)
 * Stuff like  can be extended as far as you want, although duplicate values will be ignored. Combining ,   and even   in one request is also allowed. In short: in an   request, you can use any combination of query modules.
 * As I explained in my edit summary,  is not redundant, you need it to get the last revision's timestamp, which may be different from.
 * I thought using the pipe for multivalue parameters was documented somewhere, I'll check and add it if it isn't. I'll also add a note about combining query modules if there isn't one already. --Catrope 14:19, 15 October 2008 (UTC)


 * ah, ok, that makes sense. and thanks for adding the note.  :-)

Don't watch ?
Hi,

Is there an option for not modifying your watchlist, even though you have a preference like "Automatically watch all pages I edit" enabled ? The options available on the documentation are listed below. I was looking for something like the  but without "Remove".


 * : Add the page to your watchlist
 * : Remove the page from your watchlist, or don't add it even though you have a preference like "Automatically watch all pages I edit" enabled

--NicoV 10:26, 18 October 2008 (UTC)
 * No, there is no such option. I guess we kind of expect people to know whether they're watching a page and what their preferences are. --Catrope 21:00, 19 October 2008 (UTC)


 * Thanks for the answer, but when you're editing pages on Wikipedia, the effect of this option is simply to check by default the "Watch this page" checkbox, so the user still has the choice of watching or not the page. When using the API, there's no easy way (or at least, it requires other requests) to know if the edited page is watched or not. What is strange for some users is that they think this setting is only used when directly editing (where they can choose for each edit), not when they are using a tool. --NicoV 16:12, 20 October 2008 (UTC)
 * You're right that the UI supports this option in a way; I'll investigate how hard it would be to add such an option. --Catrope 15:25, 21 October 2008 (UTC)
 * Oh wait, it doesn't. I confused the option not to change one's watchlist (which is what you want) with the option to do what the UI does by default (if you don't explicitly specify whether to watch or unwatch a page, don't change the watchlist unless your preferences say otherwise). About the confusion issue: tools making edits could simply provide a ternary choice like:
 * Watch this page
 * Don't watch this page and unwatch it if I'm already watching it
 * Only watch this page if I'm already watching it or if my preferences say to watch it (neither  nor  )
 * which should be fairly clear. --Catrope 17:52, 21 October 2008 (UTC)

About the ternary choice, it's possible but far from perfect is some situations even for edits page by page. In my own case, my own tool is a maintenance tool for small edits on a lot of pages, keeping the watchlist unchanged seems the better default option. And also, when you're doing changes in batch, this choice is not really possible because the answer could be different for each page. Thanks for the answers :) --NicoV 19:16, 21 October 2008 (UTC)

How to get the section numbers of sections?
To edit a specific section I need the section number of that section. Can anybody tell me how to get the section numbers for the sections on a page?

I tried to use:

but then I get number 1 for the first section, 1.1 for a subsection and so on. I need numbers like 1, 2, 3, and so on. No matter if section or subsection. Any clues?
 * Those numbers are sequential, so you can just count 1, 2, 3, ... from the top down. The fact that this doesn't work with sections transcluded from templates is a known bug. --Catrope 14:27, 11 February 2009 (UTC)

Here's a SectionName-to-ID converter: https://www.mediawiki.org/wiki/Topic:Udwococ9rpzcg1ku

Johnywhy (talk) 02:39, 12 June 2018 (UTC)

I need JSON type Captcha error string
I'm improving Pywikipedia to use API, but I cannot test it out the captcha error by API.--Alexsh 16:22, 18 July 2009 (UTC)
 * What do you mean by "captcha error"? Do you mean what's described here? It requires a recent enough version of the ConfirmEdit extension to work. --Catrope 22:12, 24 July 2009 (UTC)

hash match failure
Hi ya'll. The article doesn't say what is returned by the server if the MD5 hashes don't match. Is it an tag or an  tag? Thanks in advance --Sanjilops 14:59, 4 September 2009 (UTC)

Embedded MediaWiki in WebSite
Hi All, I'm new to php development and mediawiki too. I saw the Api examples and there output formats. I can change the output format, but the output comes in a file to download. Any one clearly tell me what to do with that so I can use mediawiki in my website? I installed mediawiki in my website folder at localhost.

pagedeleted error
Hi,

It seems that there's a bug with some pages that have been deleted and restaured after that, but without any more modification. For example, on the French wiki, I get the error when trying to edit fr:Charbonnage. The page exists, its last version was one 2010-03-11 at 12:37:19, but it was deleted and recreated later this day (at 17:45).

Request made: http://fr.wikipedia.org/w/api.php?summary=WikiCleaner 0.99 - Correction des liens vers les pages d'homonymie&title=Charbonnage&text=...&basetimestamp=2010-03-11T12:37:19Z&token=xxxxxx+\&minor=&bot=&action=edit&format=xml

Error reported: pagedeleted - The page has been deleted since you fetched its timestamp

--NicoV 12:32, 27 March 2010 (UTC)

Long queries failing
I am trying to edit a page and the process seems to depend on the number of characters constituting my edit query. Queries as small as 500 characters work fine, but longer queries fail with the following error.

 Request: POST http://tr.wikipedia.org/w/api.php, from 88.226.155.228 via sq35.wikimedia.org (squid/2.7.STABLE7) to Error: ERR_INVALID_REQ, errno [No Error]

Any suggestions? --Superyetkin 18:27, 4 April 2010 (UTC)


 * Okay, the solution is here. Hope this helps someone. --Superyetkin 20:21, 4 April 2010 (UTC)
 * Thanks to your hint I finally could make my script working :-) Many thanks Superyetkin --Od1n

action=edit 'bot' parameter
The text of the manual reads:
 * bot: If set, mark the edit as bot, even if you are using a bot account the edits will not be marked unless you set this flag

What if you set this parameter for a non-bot account? Why do bot accounts have to set this flag at all? Cheers, --Dmb 22:40, 28 January 2011 (UTC)
 * As far as I know, nothing happens if you set the parameter for a normal account. For a bot account, the parameter has to be set so that if a person does a manual edit with the bot account (like answering on a talk page), this edit is not marked as a bot edit. Have a nice day, 97.101.14.211 01:20, 23 August 2011 (UTC)

text from a file
Does anybody know how can I upload text from a file for a particular section? Thanks. Never mind I got it..I used `cat filename` instead of text I need help in this again, I am trying to execute the curl unix command from java and it does not accept `cat filename`. Anybody has a clue?

Appending text to a section
Is there a way to append the content of a section. This api deletes the existing section and replaces it with the supplied text.


 * I would retrieve sections contents ... Append to the string with my programming language and replace the sections contents with the result.


 * You can use the  and   parameters:

prependtext   - Add this text to the beginning of the page. Overrides text. appendtext    - Add this text to the end of the page. Overrides text
 * Hope that helped. --Ianmartorell 21:05, 27 August 2011 (UTC)


 * I found that appendtext didn't do what I wanted, somehow duplicating the entire page instead of just appending text to the section. My install's API docs say this about prependtext: "Don't use together with section: that won't do what you expect". I was forced to go the route of getting the section text, appending the new text, and setting it back. -- 193.119.19.197 16:18, 30 March 2012 (UTC)

Editing long pages with jQuery.ajax
The page says that for long texts you should use multipart/form-data, but how to do it in jQuery? KPu3uC B Poccuu (talk) 23:50, 6 June 2012 (UTC)

Result=Success, no changes applied though
Hi,

I've started a development of a java GUI bot working with db dumps and API at once, that anyone could use — even on a small wikis run by people with little or none IT knowledge (https://github.com/PavelDusek/OmniBot, english version yet to be done).

However, if I try to edit w:en:User:Pavel Dusek/sandbox, the result is Success, but the page does not change. The API response is as follows:



How about that? Could you please tell me, what may be the reason for this behaviour? Why the page does not change?

Thanks for your help in advance,

--Pavel Dusek (talk) 11:25, 30 August 2012 (UTC)


 * It looks like the "text" element you sent to the server was exactly the same as the existing content of the page; therefore, "nochange". --R&#39;n&#39;B (talk) 18:56, 30 August 2012 (UTC)


 * You were absolutely right. I used a wrong variable as an argument of a method. Thanks a lot. --Pavel Dusek (talk) 20:17, 30 August 2012 (UTC)

timestamp and edit conflict
Hello, I want api to return error when it detected edit conflict but it returns OK always. What to do? Нирваньчик (talk) 11:30, 1 November 2012 (UTC)
 * I tried to add  - not working. Edit is successful. pageTime here looks like "20121101112111" Нирваньчик (talk) 11:30, 1 November 2012 (UTC)
 * changed to pageTime to its initial format like "2012-11-01T11:48:18Z" but no help :( Нирваньчик (talk) 11:51, 1 November 2012 (UTC)

captchaid and captchaword
I don't see captchaid and captchaword anywhere in the current ApiEditPage.php. Are those still parameters? Thanks, Leucosticte (talk) 03:33, 25 February 2014 (UTC)


 * It looks like those were moved to ConfirmEdit/Captcha.php as of 1.18. They appear in both places in 1.18.3 (and probably other 1.18s, that's just the one I have), then in 1.19 and onwards, they're only in Captcha.php. So, they still get emitted, it's just that the responsibility for them is handed off to the ConfirmEdit extension. Each module appears to have the ability to customize what gets output. For example, ReCaptcha.class.php appears to use recaptcha_challenge_field and recaptcha_response_field. – RobinHood70 talk 02:12, 26 February 2014 (UTC)

The intoken parameter has been deprecated.
This warning started to pop up recently. Trying to find out more, I came across [//github.com/huggle/huggle/commit/0094aa1b7e9bd902f3dbb265b27fc74a623c45cd this edit] at the Huggle project, indicating that there's a new recommended method for getting tokens, but I haven't found any information about this in the MediaWiki documentation.. Danmichaelo (talk) 20:37, 3 October 2014 (UTC)
 * Seems there was [//www.mail-archive.com/mediawiki-api@lists.wikimedia.org/msg03286.html an email] I missed in August about this, but still a need for updated documentation. Danmichaelo (talk) 20:46, 3 October 2014 (UTC)
 * This should get people started. – RobinHood70 talk 21:48, 3 October 2014 (UTC)

Null edit ?
Hi, is there a simple way to do a null edit without sending the current page contents ?

For my need, I'm not sure a simple purge will work. The problem is with the automatic categorization of pages using duplicate arguments in template calls (example on enwiki). If I fix a page that is trancluded in other pages, the other pages are still appearing in the category. On the user interface, I tried purging the page (with the purge gadget available in the preferences) without success, but performing a null edit worked.

I'd like to do the same using the API, but it could be nice to avoid sending back the entire text. --NicoV (talk) 12:26, 20 April 2015 (UTC)


 * You can try just editing and saving section zero and see if that helps. Also, if you're on a new enough wiki (1.18+), try using purge with the  option rather than just a plain purge. I don't remember whether you want to do that on the page or on the template affected...I believe it'd be the page, but try both and see if either helps. As a last resort, on MW 1.22+, you can also try   on the affected template. That's much harder on the server, though, so don't use it unless it's really needed. – Robin Hood   (talk)  16:03, 20 April 2015 (UTC)
 * Thanks Robin Hood ! the   applied on the page seems to work. --NicoV (talk) 17:05, 20 April 2015 (UTC)

URL encoding of token
Going off the example, I have spent the past 20 minutes or so trying to figure out what was wrong with my edit code and why it was returning a badtoken error. As a sort of last resort, I removed the URL encoding of the +/ part of the token. Bam, as soon as I do this, the code works perfectly fine. Does the token need to be encoded or not?


 * It should. Is it possible that whatever method you're using takes care of the URL encoding for you automatically, so it's being double-encoded? – Robin Hood  (talk)  02:06, 30 September 2015 (UTC)
 * From what I can see in httpclient.rb (from HTTPClient, the Ruby client that MediaWiki::Butt uses), it doesn't. But it might. I'm not 100% certain on what setting the content-type header to application/x-www-form-urlencoded does, but that might be what I'm looking for? I have no idea to be honest. SatanicSanta (talk) 05:05, 5 October 2015 (UTC)

Help2
How can I replace text and remove text using API. Help me.--Maathavan (talk) 03:12, 12 April 2016 (UTC)--Maathavan (talk) 03:45, 13 April 2016 (UTC)
 * anyone help me--Maathavan (talk) 03:45, 13 April 2016 (UTC)
 * You would use a revisions query to load the text of the page you want, then alter the text in whatever way you need, and finally use this module to save the new text. – Robin Hood  (talk)  04:43, 13 April 2016 (UTC)
 * – Robin Hood Can you give an example for replacing and removing text in content.--Maathavan (talk) 17:00, 13 April 2016 (UTC)
 * Replacing or removing the text itself is up to whatever programming language you're working in. I don't believe the API has any such functionality directly. – <span style="color:royalblue; font-size:140%; font-family:Vladimir Script,serif">Robin Hood  <sup style="font-size:70%">(talk)  20:09, 13 April 2016 (UTC)

Edits randomly failing
I am adding large numbers of pages to my wiki via the Perl API. Some, maybe 5%, are creating pages that don't work correctly. Some are getting Lua error: Internal error: The interpreter exited with status 2 for the infoboxes and I've seen a few where a property is wrong. I can fix these in two ways: either edit the page via the GUI and click Save changes (without making any changes to the page), or by rerunning the Perl script to edit the page via the API (recreating the identical page).

This is with Mediawiki version 1.25.6, Semantic Mediawiki and the Perl Mediawiki::API.

Add Remove Template
Is there any way to add or remove or replace template in page in wiki directly?--Maathavan (talk) 13:44, 7 February 2017 (UTC)

Null edits
Has something changed recently with respect to null edits? A null edit through the web interface still has the expected effects, but a null edit through the API does not seem to update transcluded templates any more. --R&#39;n&#39;B (talk) 14:00, 4 May 2017 (UTC)


 * I can't answer your question, but Purge with the  option will provide the same functionality. – <span style="color:royalblue; font-size:140%; font-family:Vladimir Script,serif">Robin Hood   <sup style="font-size:70%">(talk)  17:35, 4 May 2017 (UTC)

Invalid CSRF token
I am trying to make an edit using javascript code, which is equivalent of this python script. See JS code here. I am able to extract login token, successfully login and retrieve an edit token as well. But, in the final step, while calling edit API, I get 'invalid CSRF token' error. Although, I am handling cookies, it seems like between login and extracting edit token, I am missing a step. Any helpful pointers would be much appreciated! SSethi (WMF) ~ (talk) 23:07, 3 August 2017 (UTC)
 * Hey, did you manage to work around this? I'm using JS as well and I tried a couple of things but, although I'm able to get the CSRF token, I'm still getting a bad token error when trying to edit. African Hope (talk) 04:25, 11 May 2020 (UTC)

Structured Data?
Is there a way to write structured data to a page, where some structured data already exists? Eg, CSV: Color, Info Blue, Like the sky Green, Like seaweed

i supposed one could simply write: Current text + newline + Purple, Like grapes but wondered if there was a more structured way.

The above example might work fine for new records, but not for editing existing records.

Using "Json" in the edit call might be the way. Any Json examples available? Thx Johnywhy (talk) 23:30, 26 May 2018 (UTC)

Lost Section Titles on Edit
When i edit an existing section with javascript, the section title gets overwritten by the new text. sNewDescription = 'Hello, World.'; var api = new mediaWiki.Api; api.postWithToken( "edit", {       action: "edit",        title: "Portal:TagDescriptions",        section: iSectionID,        text: sNewDescription    } ).done( function( result, jqXHR ) {        alert( "Saved successfully" );        //location.reload;    } ).fail( function( code, result ) {        if ( code === "http" ) {            alert( "HTTP error: " + result.textStatus ); // result.xhr contains the jqXHR object        } else if ( code === "ok-but-empty" ) {            alert( "Got an empty response from the server" );        } else {            alert( "API error: " + code );        }

How to prevent?

Johnywhy (talk) 16:33, 16 June 2018 (UTC)

Create page API
Hi, I am using API to create pages and the request is something like this

Now, I have to create hundreds of pages simply named Page_name_01, Page_name_02 and so on. Is there any way to do this automatically? I don't know if using API is the best way to do this (maybe there is a php script?).

Thanks in advance for the help.

Loman87 (talk) 09:15, 17 October 2018 (UTC)
 * You need to write script that send requests for every page to create in loop with counter to append to page name . --wargo (talk) 09:21, 17 October 2018 (UTC)
 * Thanks for your answer! Could you be more specific please? Loman87 (talk) 09:55, 17 October 2018 (UTC)
 * Ok, I find a way using AutoWikiBrowser and the CSVLoader plugin. Thanks anyway! Loman87 (talk) 10:56, 17 October 2018 (UTC)

items not translated in 'Possible errors'
For translators: what is the reason the 'Possible errors' items are not all set 'to be translated'
 * notitle ||
 * notext || One of the text, appendtext, prependtext and undo parameters must be set

notitle -> is well translated on the local page notext -> still remains in ENglish

API:Edit on a File: page kills the thumbnail
I've written a Python script to update the Licensing templates on a substantial number of images from CC-BY-SA-3.0 to 4.0 and this successfully updates the wikitext, but the thumbnail is replaced by "Error creating thumbnail: /bin/bash: /usr/bin/convert: No such file or directory Error code: 127". Undoing the change reverts the wikitext but doesn't restore the thumbnail.

The API parameters I'm passing are: update_params = { "action": "edit", "title": "File:A Picture.jpg", "format": "json", "nocreate": True, "text": , "token": csrf_token, "summary": "Update licence to 4.0" }

I've scoured API:Edit and found nothing specific to File: pages, I've scoured the API for some function perhaps I should be using instead, I've drawn a blank with Google and I've got no response to a question on Stackoverflow. Perhaps someone can help me understand what I'm doing wrong. --Pleriche (talk) 22:18, 12 February 2020 (UTC)