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
4
votes
1 answer

How to get a list of all films on Wikidata?

I was using Freebase to get all movies/films there for my website, but it's getting shut down soon. so I was searching for another free database for movies and came across Wikidata. To be honest it's too complicated to understand how to query all…
Mightee
  • 689
  • 7
  • 22
4
votes
1 answer

How to retrieve Wikidata entry from Wikidata search results?

I make a Wikidata search request like this (autocomplete use case): https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&type=item&continue=0&search=photog And the service returns a JSON response thus { id:…
metalaureate
  • 7,572
  • 9
  • 54
  • 93
4
votes
2 answers

Access JSON item with variable key name

The following is my JSON data which happens to be the format supplied by Wikidata, although greatly trimmed down for clarity. { "entities": { "Q200405": { "id": "Q200405", "type": "item", "claims": "Cheese" } …
MortimerCat
  • 829
  • 9
  • 26
4
votes
2 answers

Wikidata API: Check whether a Wikivoyage article is linked from Wikidata

I want to programmatically check whether an English Wikivoyage article (for instance Bronzeville) is linked from the Wikidata database or not. For instance, the Bronzeville article at English Wikivoyage is NOT linked from Wikidata (even though the…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
3
votes
2 answers

How to use Wikidata API to get ISO 3166-1 country codes?

I have been looking for examples online but can't find any for getting ISO 3166-1 country codes using the Wikidata API. It's mentioned here that one can do https://query.wikidata.org/sparql or https://query.wikidata.org/bigdata/ldf, but I don't…
Raj
  • 1,555
  • 18
  • 32
3
votes
0 answers

Wikidata Api - Istance tree of sub instance and subclass

Given an entity that is an instance of X, there is a Wikidata API that allows to view the tree of all X sub instances and/or subclasses. Example: New York is an instance of city of the United States (Q1093829). Can I know through a single call to an…
Amedeo
  • 105
  • 1
  • 9
3
votes
2 answers

Getting search results from wikidata website, but not API

I'm trying out the wikidata API but have some trouble with the search query "Jas 39 C Gripen". It returns results on the wikidata website, but not if I use the API. On The wikidata website I get two search results for the…
J. Margarine
  • 397
  • 1
  • 3
  • 8
3
votes
0 answers

How to get the cutoff timestamp or lastrevid for a given Wikidata JSON dump?

I am using Wikidata enriched with other data sources and I must ingest the entire Wikidata JSON dump in a dev graph database of mine. That's easy and once that's done, I want to keep my copy updated by querying the RecentChanges and LogEvents API…
Lazhar
  • 1,401
  • 16
  • 37
3
votes
1 answer

Get the order of claims as on Wikidata page

I request data about Wikidata entities (API action wbgetentities) and I need to have the same order of claims as on Wikidata page of an entity. I explored all the returned JSON but I did not find a property to sort them on. The order of claims keys…
greatvovan
  • 2,439
  • 23
  • 43
3
votes
1 answer

Error during a wikidata update

I've created a local version of the wikidata api using the instructions here, and after running munge.sh with the default options, I've run ./runUpdate.sh -n wdq which resulted with the following error message. ERROR…
dimid
  • 7,285
  • 1
  • 46
  • 85
3
votes
1 answer

In SparQL, how to distinguish a year like 2017, and January 1st, 2017?

The following SPARQL queries using Wikidata's REST API both return a date, of type xsd:datetime, on January 1st: >>> # Inception of Manchester United F.C. = in 1875 >>> wikidata_rest_query("SELECT ?date WHERE { wd:Q18656 wdt:P571 ?date }") {'head':…
MiniQuark
  • 46,633
  • 36
  • 147
  • 183
3
votes
2 answers

How to search in Wikidata in specific categories?

I am currently searching in Wikidata with the following query: https://www.wikidata.org/w/api.php?action=wbsearchentities&language=da&limit=20&format=json&search=jordb%C3%A6r&uselang=da I need to find different ingredients and food stuff. So the…
Ronnie Jespersen
  • 950
  • 2
  • 9
  • 22
3
votes
2 answers

Get itemlabel in python from Wikidata API

I am trying to create a list with all Harry Potter characters names using the Wikidata API. I want to get itemlabels (character names) from the link below into my Python notebook. Here is the Wikidata Query Service query which runs as I want. import…
zfa
  • 105
  • 1
  • 2
  • 7
3
votes
4 answers

Wikidata - Is this query possible?

I want to do a query on WikiData where I get all items, that are somehow connect to another item. For example I have Item "Vienna" (Q1741). Now I want to get all Items, that have Item Vienna in any property. The API I currently use is the one from…
dynobo
  • 675
  • 1
  • 6
  • 15
2
votes
1 answer

Wikidata SPARQL query that returns date a particular property was last edited on queried items

Let's say I'm looking for Wikidata cats who have their place of birth (P19) listed, using this query (also at https://w.wiki/5mdp): SELECT ?item ?itemLabel ?placeofbirthLabel ?date WHERE { ?item wdt:P31 wd:Q146; wdt:P19 ?placeofbirth; …
relizt
  • 375
  • 2
  • 11
1 2
3
10 11