Questions tagged [wikidata-api]

Related to the use of the MediaWiki API on Wikidata. Consider also the tags [wikidata] if your question isn't about the API or [mediawiki-api] if your question isn't about Wikidata.

Documentation for the API is available at mediawiki.org; a summary of all available parameters and short help is available by accessing the API endpoint on the wiki.

Please be sure to read the Etiquette page for best practices and general usage guidelines of using the API.

165 questions
5
votes
0 answers

get claims of entity wikidata by wbgetentities search label

I was wondering what the simplest way is to get data from wikidata by labels searching like : API_ENDPOINT = "https://www.wikidata.org/w/api.php" query = "cobalt-70" params = { 'action': 'wbsearchentities', 'format': 'json', 'language':…
5
votes
1 answer

Extract data from Wikidata in Python

With the following code it is possible to extract data from entities in Wikidata: import requests API_ENDPOINT = "https://www.wikidata.org/w/api.php" query = "wikipedia" params = { 'action': 'wbsearchentities', 'format': 'json', …
PeCaDe
  • 277
  • 1
  • 8
  • 33
5
votes
2 answers

How to Login to MediaWiki (Wikipedia) API in Node.js

I'm trying the Wikipedia client login flow depicted in the API:Login docs, but something wrong happens: 1) I correctly get a token raised with the HTTP GET https://en.wikipedia.org/w/api.php?action=query&meta=tokens&type=login&format=json and I get…
loretoparisi
  • 15,724
  • 11
  • 102
  • 146
5
votes
1 answer

How to get all links and their Wikidata IDs for a Wikipedia page?

(When) will the following be possible? get the list of all links on a Wikipedia page with their respective Wikidata IDs in a single query/API call. receive additional information of the respective Wikidata items like a property value with the…
G. L. Merebet
  • 97
  • 1
  • 8
5
votes
1 answer

Wikidata API always returns a Null Pointer Exception

I am using wikidata api to fetch a entity using its english title, wdf = WikibaseDataFetcher.getWikidataDataFetcher(); eid = wdf.getEntityDocumentsByTitle("enwiki", entitle); Earlier, with an older version of wikidata-api, I was able to run it…
shyamupa
  • 1,528
  • 4
  • 16
  • 24
5
votes
1 answer

How to get list of statements for a given Wikidata ID?

The only thing I managed to do is this link: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q568&format=jsonfm But this produces lots of useless data. What I need is to get all the statements for the given item, but I can't see any of…
rsk82
  • 28,217
  • 50
  • 150
  • 240
4
votes
1 answer

How to wait for Wikibase edit links to finish loading

I would like to write a Wikidata gadget, and need to wait for the page to be fully loaded, including the edit links next to each statement. I tried to wait for wikibase.view.ViewFactoryFactory but that didn't help - my code begins executing before…
Yuri Astrakhan
  • 8,808
  • 6
  • 63
  • 97
4
votes
2 answers

How to get all allowed languages for Wikidata

I'm writing a tool for interacting with Wikidata where labels and descriptions are added to items. But I would like to validate that the language is supported before trying to add it. So my question is how do I get a list of the allowed language…
Lokal_Profil
  • 384
  • 1
  • 13
4
votes
2 answers

Setting a query timeout in Wikidata api

I've created a local version of the wikidata api using the instructions here, and I'd like to specify a custom timeout to override the 60 second timeout in the official api. I haven't found anything in RWStore.properties, but perhaps I'm missing…
dimid
  • 7,285
  • 1
  • 46
  • 85
4
votes
1 answer

How to get IMDb ID for some film article from the Russian Wikipedia?

I'm collecting data about some films in Russian and, using Wikipedia API, I can query data about required film in JSON format: https://ru.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles=%s where %s is a title…
cybersoft
  • 1,453
  • 13
  • 31
4
votes
1 answer

Wikidata API wbsearchentities: why are results not the same in Python than in Wikidata?

I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python: url =…
Patrick
  • 2,577
  • 6
  • 30
  • 53
4
votes
1 answer

How to use `relevantTopicIds` from YouTube Data API v3?

As stated in this documentation: "Search with Freebase Topics" and in the available video as well, the YouTube Data API v3 offers certain Freebase MIDs when using topicDetails as an argument for part. My question is how can I use those returned…
4
votes
1 answer

How to reliably get the image used in the Wikipedia Infobox?

How do I (reliably) get the main image(s) used in the Wikipedia Infobox from the API? This question has been asked before and the accepted answer admits that it is just a guess. Subsequent answers seem like a hack, at best and don't return the…
user776942
4
votes
2 answers

Cannot access Wikidata API

I'm trying to use the Wikidata API, but all I'm getting is: Fetch API cannot load https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Ingmar%20Bergman&language=en&limit=20&format=json&origin=http%3A%2F%2Fwww.dev.example.com%3A3000.…
4
votes
2 answers

How can I query wikidata with a freebase id from a youtube video?

I am using the youtube API to retrieve the freebase topic details of particular videos. Since freebase is closing down how do I use wikidata to query for a specific topic id? For example the following topic id /m/0181lj should give the following…
david_adler
  • 9,690
  • 6
  • 57
  • 97
1
2
3
10 11