Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Numinix MediaWiki Demo
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
API/Edit
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== User cases == <!--T:101--> === Edit conflicts === <!--T:19--> </translate> <translate><!--T:20--> The [[<tvar name=1>#Sample code</tvar>|Python sample]] is a basic implementation of an edit request by a registered user.</translate> <translate><!--T:21--> In real-world scenarios, care should be taken to prevent edit conflicts.</translate> <translate><!--T:22--> These occur when two or more users are attempting to edit the same page at the same time.</translate> <translate><!--T:23--> Conflicts can be prevented by retrieving the last timestamp when we request a CSRF token.</translate> <translate><!--T:24--> Adding <tvar name=1><code>prop=info|revisions</code></tvar> to the CSRF token request in Step 3 allows us to access the timestamp for the last revision.</translate> <translate><!--T:25--> This timestamp will be used as the <tvar name=1><code>basetimestamp</code></tvar> when we make our the edit request.</translate> <translate><!--T:26--> We also need the exact time when we start our edit.</translate> <translate><!--T:27--> This can be retrieved by adding <tvar name=1><code>curtimestamp</code></tvar> to the CSRF request as well.</translate> <translate><!--T:28--> This value will serve as our <tvar name=1><code>starttimestamp</code></tvar>.</translate> <translate> <!--T:29--> Finally, in the actual edit request, set the <tvar name=1><code>basetimestamp</code></tvar> and <tvar name=2><code>starttimestamp</code></tvar> parameters, like so: </translate> <translate> === Large edits === <!--T:30--> </translate> <translate><!--T:31--> POST requests containing large amounts of text content (8000+ characters) should be sent with <tvar name=1><code>Content-Type: multipart/form-data</code></tvar> indicated in the [[<tvar name=2>devmo:Web/HTTP/Headers</tvar>|header]].</translate> <translate><!--T:32--> Because <tvar name=1><code>multipart/form-data</code></tvar> does not need to add HTML escape characters (i.e., [[<tvar name=2>devmo:Glossary/percent-encoding</tvar>|percent encoding]]) for spaces and punctuation, the amount of data passed will subsequently be much smaller than the percent-encoded equivalent.</translate> <translate><!--T:33--> However, there is still some overhead added by <tvar name=1><code>multipart/form-data</code></tvar> -- roughly, 160 bytes per parameter.</translate> <translate><!--T:34--> For short messages that don't require adding many escape characters, this amount of overhead can be inefficient, and percent-encoding is preferred.</translate><ref> https://stackoverflow.com/a/4073451 </ref> <translate> <!--T:35--> Note that in our [[<tvar name=1>#Example</tvar>|Python sample code]], the request is percent-encoded by default. </translate> <translate><!--T:36--> See [[<tvar name=1>devmo:Web/HTTP/Headers/Content-Type</tvar>|the MDN web docs]] for a more technical discussion of content-type and POST requests.</translate> <translate><!--T:37--> See [<tvar name=url>http://docs.python-requests.org/en/master/user/quickstart/#more-complicated-post-requests</tvar> the Python Requests documentation] for how to pass <tvar name=1><code>multipart/form-data</code></tvar> using syntax similar to our Python sample code.</translate> <translate> === CAPTCHAs === <!--T:38--> </translate> <translate><!--T:39--> If the wiki you are targeting uses , your request may return an error containing an ID number and a simple test, such as a question, a math problem, or a URL to an image.</translate> <translate><!--T:40--> In order to complete your edit, you must complete the test, then retry your request with the id and the correct answer(s) appended to the original query string, like so:</translate> <code>captchaid=sampleId&captchaword=answer</code> <translate><!--T:41--> Other CAPTCHA systems and extensions may use different parameters for similar use.</translate> <translate><!--T:42--> In general, use the field names for the ID and test questions as the parameters in your second request.</translate> <translate>
Summary:
Please note that all contributions to Numinix MediaWiki Demo may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)