1 of 16

Wikibase REST API

Making it easier to program with Wikidata’s data

Silvan Heintze & Lydia Pintscher - Wikimedia Deutschland

2 of 16

Why a new API for Wikibase?

3 of 16

We want more people to build applications on top of Wikidata’s data.

(Also other Wikibase instances!)

4 of 16

But it’s hard!

5 of 16

Wikibase REST API to the rescue!

  • Provide a more industry- standard and versioned way to access and manipulate data in Wikibase
  • Provide an API that is more tailored to the Wikibase data model
  • Solve a number of issues in the current API that are easier to solve with REST

6 of 16

Meet the new Wikibase REST API!

7 of 16

What you can do already with the new API

  • Retrieve Item data, filter fields in response (e.g., type, labels, descriptions, aliases, statements, sitelinks)
  • Retrieve all statements on an Item
  • Retrieve data in a single statement or statement group
  • Create or remove a statement on an Item
  • Replace an existing statement on an Item

8 of 16

Comparison to Action API

9 of 16

Item Data

  • Uses statements instead of claims

10 of 16

Labels, Descriptions, Aliases

  • Use flat structure

11 of 16

Statement data

  • The mainsnak field is removed
  • A top level property field is introduced, holding both the id and data-type
  • A top level value field is added, consisting of two fields: content and type
  • The fields mainsnak.hash and datavalue.type are removed
  • All fields are always included in the response, even when empty

12 of 16

Metadata

  • pageid, ns, and title fields are omitted
  • revision ID and last modified date are included in HTTP response headers
  • success state is represented in HTTP response code (2xx vs 4xx)

13 of 16

Demo

14 of 16

What’s next?

15 of 16

Where do we go from here?

  • Get feedback on the current version and plan how to proceed with for example support for other entity types
  • Not (yet): deprecate the Action API

16 of 16

Get in touch!

  • Overview
  • Documentation
  • Feedback