Extension:Wikibase Repository/API3


 * Old versions: Extension:Wikibase/API1, Extension:Wikibase/API2

Additional API specification for Wikibase are additional description of how the API modules for Wikibase are supposed to behave, mostly with focus on how the server (where the Wikibase extension runs) is supposed to respond to requests from clients in general (where the Wikiclient extension runs) and browsers especially (where a Javascripts loaded by ResourceLoader). This is not a complete description, check the [//labs.wikimedia.org/w/api.php labs API's documentation] (missing correct labs instance) for further details (just a dummy link, use localhost for now, later use labs).

Note that this documentation is not final and that it will change due to new or changed requirements from the project and its main objective. The projects main objectiveis to build the extension, interfacing with other tools are other secondary outcome. As such this will be an attempt on a best practice for the API given contraints from other ducumentation and the API itself, but as the existing API are generic there must be made some trade offs due to responsiveness and code complexity.

General parameters
There are some general parameters that could be useful. Those are format, smaxage, maxage, maxlag and requestid. In the self documenting API all of them except format is described first on the page.

Parameter format is used to define the return format, usually always set to json for the extension but could also be set to xml for other tools. For debugging use the values jsonfm and xmlfm to get a pretty printed version. There are several other formats, check the documentation. Make sure that new modules in fact responds with the correct structure.

Parameter smaxage and maxage is used when interacting with caching. Do not set them unless it is clear that previous requests can be reused.

Parameter maxlag is used for throttling of requests, use longer times for more important requests. Setting this parameter will make it necessary to implement error handling.

Parameter requestid it can be used where several requests are handled in parallel. This can speed up interaction with the server.

Not implemented
Typical error message when an function is not implemented and  is set ([//labs.wikimedia.org/w/api.php?action=wbgetitem&id=42&format=jsonfm labs], localhost)