Extension:Proofread Page/Index data API

The ProofreadPage extension provides read/write access to index categories and fields in both Wikitext and JSON. Usually, for API access, JSON is easier.

Index field and category data is both stored in the main slot of an index page.

Note that while you can choose the content format, the content model of an index page is always.

Reading
Read the main slot content with  (see API:Parse), setting   as you wish:
 * JSON:  (as of 29 Oct 2022, this is currently broken, see T321446)
 * Wikitext:  (default if not given)

Example: https://en.wikisource.org/w/api.php?action=parse&format=json&formatversion=2&page=Index%3ASandbox.djvu&prop=wikitext&contentformat=application%2Fjson

Specifically, the  field contains serialised JSON. You can deserialise this and manipulate it, then write it back.

Writing
This is done with the usual  action (see API:Edit).

You will need to provide a valid token to perform any  action.