mediawiki-apiwikimedia-commons

Get list of pages using an image hosted on Wikimedia commons through API


I'd like to get the file usage on other wikis for a given image on Wikimedia Commons through API.

For example the image https://commons.wikimedia.org/wiki/File:2015_Finland_opinion_polls.png is used in:

How can i get this information using API? I tried both the wikimedia commons API and the Mediawiki Image API but without luck.


Solution

  • You need the Globalusage API call.

    For your example the URL would be:

    https://www.mediawiki.org/w/api.php?action=query&prop=globalusage&titles=File:2015_Finland_opinion_polls.png