This is an announcement for a significant, but not breaking, change to the
response format of the wbsearchentities API. So far, each search result has
included "label" or "description" members- which included the
label/description of the matched entity- so that it could be shown to
users. However, these were plain strings with no indication of the language
of the label or description: if language fallback happened (e.g. if the
search was in Arabic, but the item only had an English description), then
there would be no indication of this in the response. Users of the API
couldn’t know what the language of the returned label/description was
without a separate API call to retrieve the entity’s data. This is for
example necessary for screen readers to read out the label/description in
the correct language. (We will follow up with other changes to make use of
it in the Wikibase UI, so that screen readers there are getting a better
indication of which language to read out.)
We have resolved this with the addition of a new "display" member to the
search result structure, which contains a "label" and "description"
are not plain strings, but rather objects with "language" and "value"
members (like labels and descriptions in the normal JSON serialization
The old "label" and "description" fields are still there, but
we recommend that you don’t use them in new code. Please note that, just
like the "label" and "description" were always optional (i.e. could
missing for entities that had no label or description available in the
request language or a fallback language), so the "label" and
in the new response are also optional (under the same conditions).
This change was already deployed to Beta Wikidata, Test Wikidata, and
Wikidata. If you have any questions or feedback, please feel free to let us
know in this ticket <https://phabricator.wikimedia.org/T104344>.
*Community Communications Manager for Wikidata/Wikibase*
Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
Keep up to date! Current news and exciting stories about Wikimedia,
Wikipedia and Free Knowledge in our newsletter (in German): Subscribe now
Imagine a world in which every single human being can freely share in the
sum of all knowledge. Help us to achieve our vision!
Wikimedia Deutschland – Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.