GET [...]/rest.php/wikibase/v0/search/items?language=en&q=...
Request parameters (query parameters)
- q - search term
- language - language code
Response structure in pseudo-JSON
{
"results": [
{
"id": "Q123",
"label": "<LABEL in language>"
"description": "<DESCRIPTION in language>"
},
...
]
}Response:
- always respond with status code 200, even for an empty result list
- deal with error handling (500) later
Not in scope:
- validation (errors on invalid input) of language codes
- including a matched data element in the response
- no special treatment of haswbstatement etc "keywords". Pass them as-is
- search results provided in an asynchronous response
- no fallback language treatment of labels or descriptions in the search results
In scope:
- "input sanitization" that existing functionality interacting with Cirrus search/ Elastic search should be included here
- no hard dependency on Cirrus search extension -- the API should return no results/empty results list with no search backend. In other words, the first iteration does not have to do anything special when no Elastic search is there, but software should not "explode" (no code paths triggering exceptions etc)
Task Breakdown Notes
- create OpenAPI specification
- create use case with request and response objects
- including unit tests
- create RouteHandler that makes use of the use case
- including end-to-end test and openapi validation test
- look into sanitizing inputs to avoid potential elastic search failures (see wbsearchentities) --> leave out if not needed
- deal with potential absence of the Cirrus search extension --> empty result