13

Let's say I have a Wikidata item QID Q19675, and want to get the name of that item in Spanish.

While getting a property like P281 postal code is easy, how to get the name, which for some reason is not a normal property? Preferably via the REST API.

Wikidata item name

2

2 Answers 2

14

You probably want this:

https://www.wikidata.org/w/api.php?action=wbgetentities&props=labels&ids=Q19675&languages=es

The API command in English: Get information about some entities (action=wbgetentities), namely the label properties (props=labels) of item Q19675 (ids=Q19675) in Spanish (languages=es).

For more details, have a look at the full documentation of wbgetentities.

2
  • but cab I use Wikidata Query Service SPARQL for this?
    – Alexan
    Oct 24, 2016 at 0:44
  • 1
    @Alex Yes, but please ask a new question, because this one focuses on the REST API. Oct 24, 2016 at 8:19
7

You can get it also using SPARQL:

SELECT DISTINCT * WHERE {
  wd:Q19675 rdfs:label ?label . 
  FILTER (langMatches( lang(?label), "ES" ) )  
}

See it on Wikidata Query Service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.