Page MenuHomePhabricator

🐯 Provide data of all statements on a property
Closed, ResolvedPublic13 Estimated Story Points

Description

As tool builder I want to read data of statements on property so that I can use them in my tool.

GET /entities/properties/{property_id}/statements

Notes

Error cases to consider

HTTP response coderesponse payload
Property does not exist404"code": "property-not-found"
"message": "Could not find a property with the ID: {property_id}"
Invalid property ID400"code": "invalid-property-id"
"message": "Not a valid property ID: <PROPERTY_ID>"
"context": { "property-id": "<PROPERTY_ID>" }

Possibly useful pointers:

  • Suggestion in 2020 Wikibase REST API proposal: ...
  • How Wikibase Action API handles this: ...
  • Story for initial implementation of the item endpoint: T305988
  • Story about filtering statement data on items: T309021

Event Timeline

WMDE-leszek renamed this task from Provide data of all statement on a property to Provide data of all statements on a property.Jun 16 2023, 1:34 PM
WMDE-leszek changed the edit policy from "Custom Policy" to "All Users".

Task Breakdown Notes

After some confusion, we have clarified that in contrast to the single statement endpoints, which all have short routes without an Item or Property ID, this new endpoint does not operate on a single identifyable statement. Instead, it operates on a Property and therefore we conclude that ADR 12 applies and we are creating a separate GetPropertyStatements use case for the new route.

  • add new endpoint to OpenAPI document – @Ollie.Shotton_WMDE
  • create the PropertyStatementsRetriever interface – @WMDE_Norman
  • implement the PropertyStatementsRetriever@Silvan_WMDE
    • (hint: take a look at EntityRevisionLookupPropertyDataRetriever)
  • implement the happy path: – @Muhammad_Yasser_Jazirahly_WMDE
    • basic route handler
    • including filtering by property ID
  • add revision metadata and check existence – @Ollie.Shotton_WMDE
    • response headers
    • 404 error response when property not found
  • add request validation: – @WMDE_Norman
    • validate subject property ID
    • validate filter property ID
    • 400 response in case of error, including context
  • add the usual middlewares: – @Silvan_WMDE
    • User-Agent, Preconditions, Auth, Unexpected Errors
  • spec test – @Muhammad_Yasser_Jazirahly_WMDE
  • mark new endpoint as production ready – @Ollie.Shotton_WMDE
Silvan_WMDE renamed this task from Provide data of all statements on a property to 🐯 Provide data of all statements on a property.Jun 28 2023, 2:01 PM

@WMDE-leszek It would make the implementation easier if the key in the "context" for the "invalid-property-id" was the same between this story and T339363: 📮 Add a statement to a property. One is property-id the other is property.

we should use what is there already, for now.

Just checked this with @WMDE-leszek. I'll move it to Done if that's okay?

Thanks both! Yes, please move to Done if happy with the changes. =)