Quantcast

RV: Wikidata API Language not working

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RV: Wikidata API Language not working

Delia Fernandez
Hello,

I'm using the Wikidata api to translate entities ids to its name in English and Spanish. I found out that the language parameter is not working

When I search for the entity id: Q2537 (https://www.wikidata.org/wiki/Q2537)

Search request in English: https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Q2537&language=en&format=json
Response: {"searchinfo":{"search":"Q2537"},"search":[{"id":"Q2537","concepturi":"http://www.wikidata.org/entity/Q2537","url":"//www.wikidata.org/wiki/Q2537","title":"Q2537","pageid":3505,"label":"natural satellite","description":"celestial body that orbits a planet or smaller body","match":{"type":"entityId","text":"Q2537"},"aliases":["Q2537"]}],"success":1}

Search request in Spanish: https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Q2537&language=es&format=json
Response: {"searchinfo":{"search":"Q2537"},"search":[{"id":"Q2537","concepturi":"http://www.wikidata.org/entity/Q2537","url":"//www.wikidata.org/wiki/Q2537","title":"Q2537","pageid":3505,"label":"natural satellite","description":"celestial body that orbits a planet or smaller body","match":{"type":"entityId","text":"Q2537"},"aliases":["Q2537"]}],"success":1}

Notice that I'm changing the language parameter, but the results are always in English.

I tried other languages, like fr (French), and the response is also in English.
When I made up a language it gives an error search.

I hope you can attend to this issue,
Thank you.

Dèlia

_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RV: Wikidata API Language not working

Legoktm
Hi,

On 11/02/2016 09:31 AM, Delia Fernandez wrote:
> Search request in Spanish: https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Q2537&language=es&format=json
> Response: {"searchinfo":{"search":"Q2537"},"search":[{"id":"Q2537","concepturi":"http://www.wikidata.org/entity/Q2537","url":"//www.wikidata.org/wiki/Q2537","title":"Q2537","pageid":3505,"label":"natural satellite","description":"celestial body that orbits a planet or smaller body","match":{"type":"entityId","text":"Q2537"},"aliases":["Q2537"]}],"success":1}

Actually, this API query means search for "Q2537", and you're saying
that string is in Spanish. I think what you actually want is:

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q2537&format=json

And if you just want Spanish, you can do:

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q2537&languages=es&format=json

You can see the documentation and some examples for the wbgetentities
API module at:

https://www.wikidata.org/w/api.php?modules=wbgetentities

-- Legoktm

_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Loading...