Page MenuHomePhabricator

🟦 Create 404 error response for non existing item IDs in GET /entities/items/{item_id}
Closed, ResolvedPublic

Description

Story:
WHEN I request GET /entities/items/{item_id} with ID of item that does not exist
THEN I get 404 HTTP response
AND it contains a item-not-found code and a message "Could not find an item with the ID {item_id}"
AND a HTTP header Content-Language set to en

Tasks:

  • return null from WikibaseEntityLookupItemRevisionRetriever in case no entity revision can be found for a given ID
  • if item revision is null, then a "failure" GetItemResult (with isSuccessful() == false) will be returned from the GetItem use case
  • the RouteHandler will create an error response (set http status, code, message) based on the GetItemResult

Event Timeline

Ollie.Shotton_WMDE renamed this task from 🟦 Handle 404 error in GET /entities/items/{item_id} to 🟦 Create 404 error response for non existing item IDs.Mar 16 2022, 9:24 AM
Ollie.Shotton_WMDE renamed this task from 🟦 Create 404 error response for non existing item IDs to 🟦 Create 404 error response for non existing item IDs in GET /entities/items/{item_id}.Mar 16 2022, 9:28 AM
Ollie.Shotton_WMDE updated the task description. (Show Details)

Change 771345 had a related patch set uploaded (by Ollie Shotton; author: Ollie Shotton):

[mediawiki/extensions/Wikibase@master] REST: Implement 404 error response for non existing item IDs in GET /entities/items/{item_id}

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

Change 771345 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Implement 404 response for item not found

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

WMDE-leszek claimed this task.