Search code examples
javaandroidmediawiki-apigoogle-image-searchwikidata-api

How to get image URL property from Wikidata item by API?


I've made an android app that uses the JSON Google image search API to provide images but I have noticed that Google have stopped supporting it. I have also discovered that Wikidata sometimes provides a image property on some items, however I can't seem to get the URL location of the image using the Wikidata API.

Is there any way to get the image URL property from items in Wikidata?


Solution

  • You can build URLs from the image property (Sample.png in the following example):

    https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/Sample.png&width=300
    

    See Wikimedia Commons' "Reusing content outside Wikimedia" documentation for more details.