Page MenuHomePhabricator

๐ŸŸง Create an initial implementation of GET /statements/{statement_id}
Closed, ResolvedPublic5 Estimated Story Points

Description

As a gadget developer I want to read data of a single statement so that I can use it my gadget.

return a json representation of the statement as returned by the /entities/items/<item_id> endpoint for a single statement in the statements section.
error handling:

  • 400 - invalid statement ID including statement IDs of statements not on Items
  • 404 - statement not found
  • 500 - unexpected

Spec: https://wmde.github.io/wikibase-rest-api-proposal/#/statements/get_statements__statement_id_

Related Objects

Event Timeline

Jakob_WMDE set the point value for this task to 5.Apr 28 2022, 10:41 AM

Task breakdown notes:

Questions (now answered in comments below):

  • what should be the error code and error message when the statement ID is invalid?
  • what should be the error code and error message when the statement does not exist?
  • What do we do when requesting a statement that belonged to an item that was redirected? The statement ID completely changes during a merge (prefix and suffix). It could be useful for the user to know that the item was redirected.

TBD:

  • create a task for redirects if we do redirects for individual statements
Ollie.Shotton_WMDE renamed this task from Create an initial implementation of GET /statements/{statement_id} to ๐ŸŸง Create an initial implementation of GET /statements/{statement_id}.Apr 29 2022, 2:30 PM

what should be the error code and error message when the statement ID is invalid?

error code: invalid-statement-id
error message: "Not a valid statement ID: {statement_id}"

what should be the error code and error message when the statement does not exist?

error code: statement-not-found
error message: "Could not find a statement with the ID: {statement_id}"

Finally, regarding

What do we do when requesting a statement that belonged to an item that was redirected? The statement ID completely changes during a merge (prefix and suffix). It could be useful for the user to know that the item was redirected.

It sounds like potentially useful functionality for some use cases. However, there is currently no support in the Wikibase backend/logic that would allow API to know what statement was redirected to. Therefore adding such a functionality would mean a substantial effort that does not seem to be providing enough benefit at this point in Wikibase REST API development cycle.
Therefore, if the input statement ID is an ID of a statement made on the item that was redirected API should treat the statement ID as a non-existent ID.