Page MenuHomePhabricator

[5.2.8b Milestone] Onboard Wikibase as an API module and externally defined OAD spec
Open, MediumPublic

Description

Description

The Wikibase extension is installed on only a few Wiki projects, but plays a critical role for those communities. For example, the Wikidata REST API is not differentiated from the Wikibase API; it is simply the Wikibase API running against the Wikidata project.

The list of endpoints contained in this module is extensive, meaning that it is a huge list to include as part of the "Flat route" implementation. The documentation presented in the flat route structure is also duplicative, misleading, and incomplete compared to the "official" Wikibase REST API documentation, found here: https://doc.wikimedia.org/Wikibase/master/js/rest-api/
See flat route example: https://www.wikidata.org/wiki/Special:RestSandbox

The purpose of this work is to surface the high quality spec created by the Wikibase Reuse Team (WMDE) through the REST Sandbox

Conditions of acceptance

  • Create Wikibase v1 API module
  • Surface externally managed Wikibase OAD in the REST Sandbox for projects where it is enabled
    • Remove Wikibase routes from MediaWiki 'flat route' structure
  • Create a mechanism that allows setting a 'default' module within the REST Sandbox per wiki project
  • Update links on Wikidata to point to the REST Sandbox instead of the doc site
  • [Stretch/TBD] Redirect doc.wikimedia documentation (https://doc.wikimedia.org/Wikibase/master/js/rest-api/) to the Meta REST Sandbox (?)

Implementation details

The high quality spec can be retrieved through this endpoint: https://www.wikidata.org/w/rest.php/wikibase/v1/openapi.json

Because this is a manually managed spec, we expect that the server option will not be correct at this time. By default, the server options will include "example" and "Wikidata" as options on all Wikis.

OPEN QUESTIONS:

  1. Where should the doc site redirect to, for cases where people might be seeking basic Wikibase information? Meta? Even though the extension is not installed there?
  2. Is there any meaningful divide between what is defined as wikidata vs wikibase in this case? the base URL is specifically connected to the Wikidata project, but is presented as the Wikibase REST API.
  3. Is there a way for us to populate the server field dynamically? Perhaps by specifying a parameter when requesting the spec from Wikidata? --> this would have a dependency on the Wikibase Reuse Team.

Event Timeline

BPirkle triaged this task as Medium priority.Apr 6 2026, 6:54 PM
BPirkle moved this task from Incoming (Needs Triage) to Backlog on the MW-Interfaces-Team board.
HCoplin-WMF renamed this task from Onboard Wikibase as an API module and externally defined OAD spec to [5.2.8b Milestone] Onboard Wikibase as an API module and externally defined OAD spec.Apr 7 2026, 3:12 AM
HCoplin-WMF updated the task description. (Show Details)
HCoplin-WMF edited projects, added: [MWI] FY2025-26 Q4; removed: MW-Interfaces-Team.

Is there any meaningful divide between what is defined as wikidata vs wikibase in this case?

No, the "Wikidata REST API" is just the Wikibase REST API on the wikidata.org instance. The Wikibase REST API is available on all instances v1.43+.

The high quality spec can be retrieved through this endpoint: https://www.wikidata.org/w/rest.php/wikibase/v1/openapi.json

FYI, this endpoint is available on any Wikibase v1.43+. E.g. https://lgbtdb.wikibase.cloud/w/rest.php/wikibase/v1/openapi.json

Because this is a manually managed spec, we expect that the server option will not be correct at this time. By default, the server options will include "example" and "Wikidata" as options on all Wikis.

Currently, the server hardcoded into the spec is https://wikibase.example/w/rest.php/wikibase.

It looks like the Wikibase Reuse Team has thought about adding more servers to the spec: T420319: Add more servers to the REST API OpenAPI specs

I imagine it would be possible for the "hardcoded" spec to be partially dynamic and include the URL of the Wikibase instance it is served from, but I'll let the team weigh in on that.