As a reuser familiar with the concept of Wikibase language fallback, and the special position of "mul" code on Wikidata, I want to get a label or description in the requested language, or a respective language from the fallback chain, so that I can show them in my application.
GET /entities/items/{item_id}/labels_with_language_fallback/{language_code}
GET /entities/items/{item_id}/descriptions_with_language_fallback/{language_code}
GET /entities/properties/{property_id}/labels_with_language_fallback/{language_code}
GET /entities/properties/{property_id}/descriptions_with_language_fallback/{language_code}
All aspects of API behaviour (input validation, error responses, response structure, conditional HTTP header handling, authentication, etc) are to be same as for the respective no-language-fallback APIs unless stated otherwise
- If there is no label or description defined in the language represented by{language_code}but they're defined in any of the languages defined by the Wikibase language fallback chain for{language_code},API should respond with a 307 HTTP code, and include aLocationheader linking to a respective non-fallback resource, e.g. if there is noenlabel but there is one inmulon item Q123GET /entities/items/Q123/labels_with_language_fallback/enis intended to result with 307 redirect response withLocation:.../entities/items/Q123/labels/mul
- If there is no label or description in the requested language, and in any of the respective languages defined by Wikibase language fallback chain, API should respond with 404resource-not-foundresponse.
Task Breakdown Notes
- copy-paste existingGetLabeluse case toGetLabelWithLanguageFallbackand create new route handler for the new URL
- modify use case and route handler to handle language fallback
- create new interfaceItemLabelWithFallbackRetriever
- useFallbackLabelDescriptionLookupFactoryto create a language fallback lookup
- do not throw Redirect exception, instead return label with fallback language if no label exists in the requested language
- let RouteHandler handle 200 vs 307 response based on the response's language code (equal to requested language or not?)
- repeat for the other three routes