This allows us to get the following data from the Commons file name :
- Depicts statements (list of Wikidata IDs only, no labels)
- Captions in all entered languages
---
Parameters for call to https://commons.wikimedia.org/w/api.php
| action | [[ https://commons.wikimedia.org/w/api.php?action=help&modules=wbgetentities | wbgetentities ]] |
| titles | //[filename]// |
|sites | commonswiki |
example: https://commons.wikimedia.org/w/api.php?action=wbgetentities&titles=File:DIWALI_A_FESTIVAL_OF_LIGHTS.jpg&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
```