Page MenuHomePhabricator

Expose "PageQuality" to API action=edit
Closed, DuplicatePublic


From IRC

[15:15:51] <shrini> hello all
[15:16:08] <shrini> I am trying to use api to edit wiki pages
[15:16:23] <shrini> in wikisource for tamil language
[15:16:33] <shrini> I can do all the basic edits
[15:16:53] <shrini> but this wikisource has some special form based buttons to mention the edit status
[15:16:55] <shrini>
[15:17:01] <shrini> see here for a screenshots
[15:17:14] <shrini> how to click those buttons via api ?

They were talking about

<span id="wpQuality-container"><span class="quality0"><input tabindex="5" title="Without text" type="radio" value="0" name="wpQuality"></span><span class="quality2"><input tabindex="6" title="Problematic" type="radio" value="2" name="wpQuality"></span><span class="quality1"><input tabindex="7" title="Not proofread" checked="" type="radio" value="1" name="wpQuality"></span><span class="quality3"><input tabindex="8" title="Proofread" type="radio" value="3" name="wpQuality"></span></span>

Event Timeline

Tpt subscribed.

Duplicates of T30894.

The current way to do it is to call action=query&prop=revision to get the Page: page content in JSON

Then modify the level.level field and set level.user to your user name and publish the modify content using action=edit and setting contentformat=application/json

Add: its need to fix another option of API to Action=edit, Header Footer, Page body separately to resolved our one issue of Google OCR Script.

@Tpt Need help on forming the api fir edit action.

I get the following error


"servedby": "mw1134",
"error": {
    "code": "internal_api_error_MWContentSerializationException",
    "info": "[VyEt3gpAEHIAAC3ySf4AAABO] Exception Caught: The serialization is an invalid JSON array."


Testing with following url.\

Simple edit query without the level and user info is giving serialization error. Not sure on how to add the level and user details.

Will be so helpful if you give the working example with level, user info set for edit api.


payload = {'action': 'edit', 'contentformat':'application/json', 'utf8': '', 'appendtext': page_body,'summary': summary, 'title': title, 'token': token, 'contentmodel':'proofread-page','level':{'level':2,'user':wiki_username}}

page =

Calling like this in python using simplemediawiki module.

This gives error as

{u'edit': {u'contentmodel': u'proofread-page',

u'nochange': u'',
u'pageid': 404589,
u'result': u'Success',
u'title': u'Page:\u0b95\u0bc1\u0bb1\u0bbf\u0b9e\u0bcd\u0b9a\u0bbf \u0bae\u0bb2\u0bb0\u0bcd.pdf/500'},

u'warnings': {u'main': {u'*': u"Unrecognized parameter: 'level'"}}}

Need help on setting this json witl level parameter.


You shouldn't use the "appendtext" parameter and use the "text" parameter that should be a serialization of this JSON tree:

  "header": THE_PAGE_HEADER,
  "body": THE_PAGE BODY,
  "footer": THE_PAGE_FOOTER,
  "level": {

THE_PAGE_HEADER the header (probably just "")
THE_PAGE_BODY the body (probably the OCR output)
THE_PAGE_FOOTER the footer (probably something like "<references />"
THE_PROOFREADING_LEVEL the proofreading level (an integer between 0 and 4 with 0: page without text, 1: not proofread, 2: probablematic, 3: proofread, 4: validated). You will probably use 1
THE_PROOFREADING_USER the user who have asserted this proofreading user. Should be the user doing the edit

Thanks @Tpt

For the following code,

payload = {'action': 'edit', 'contentformat':'application/json', 'utf8': '', 'body': page_body,'summary': summary, 'title': title, 'token': token, 'contentmodel':'proofread-page','level':{'level':2,'user':wiki_username}}

page =

getting error as

{u'error': {u'*': u'See for API usage',

u'code': u'notext',
u'info': u'One of the text, appendtext, prependtext and undo parameters must be set'},

Do I miss to add something?


page = didnt set text=....

Try page =

If that doesnt work, file a support request with your python library.