This allows us to get the following data from the Commons file name :
- Depicts statements (list of Wikidata IDs only, labels are found after in T222495)
- Captions in all entered languages
Parameters for call to https://commons.wikimedia.org/w/api.php
action | wbgetentities |
titles | [filename] |
sites | commonswiki |
result = response.entities[mediaIdentifer] //only property in response.query.pages depictsStatements = result.statements.P180 //array of 'depicts' statements
Each element in the array is an object representing a single depicts statement. The Wikidata item for each statement is found with:
depictsStatement.datavalue.value.id