wikipedia-apiwikidata-apiwikimedia-commons

How to get a list of image file names from Wikimedia Commons with just a Wikidata ID


So the linked answer said how to get one image from Wikidata property P18:

https://stackoverflow.com/a/34402875/1448813

But how do I get a list of images from wikimedia commons? We have the property P935 which gives us the gallery category name (or page name, I'm not sure what it is). I'm guessing I have to use the Commons API to get the list of relevant images, but I wasn't successful.

For example, I have the Reichstagsgebäude json of property P935. What do I do with it?


Solution

  • Use the categorymembers API. It can also be used as a generator if needed.