Page MenuHomePhabricator

Allow filtering what elements of property to include in data read from the Wikibase REST API
Closed, ResolvedPublic5 Estimated Story Points

Description

As a developer I want to fetch the data of a property, so I can use elements I need in my application

Further building up the GET /entities/properties/{property_id} route/endpoint, following the initial development in T337720.

Using an in-path _fields parameter, accepting values:

  • type
  • data-type
  • labels
  • descriptions
  • aliases
  • statements

Error cases to consider:

  • client provided a field which is not recognized: API responses with HTTP 400 response. Response content: { "code": "invalid-field", "message": "Not a valid field: {field}" }

Event Timeline

Jakob_WMDE set the point value for this task to 5.Jun 8 2023, 9:25 AM

Change 929374 had a related patch set uploaded (by Muhammad Jaziraly; author: Muhammad Jaziraly):

[mediawiki/extensions/Wikibase@master] REST: Fetching properties with `_fields` filter

https://gerrit.wikimedia.org/r/929374

Change 929374 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Fetching properties with `_fields` filter

https://gerrit.wikimedia.org/r/929374

Filtering works as expected, thank you!
I would have expected the parameter to be documented in the specification/autodocs, though. This seems to be missing.

Thanks, and yes, I totally forgot it, I'll be working on it today, and I'll keep you updated when it's finished.

Change 930207 had a related patch set uploaded (by Muhammad Jaziraly; author: Muhammad Jaziraly):

[mediawiki/extensions/Wikibase@master] REST: Add _fields to GET properties in OAS

https://gerrit.wikimedia.org/r/930207

Change 930207 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Add _fields to GET properties in OAS

https://gerrit.wikimedia.org/r/930207

Hello @WMDE-leszek, I've added the missing _fields documentation to OAS. 👍