Example file without <file depicts (P180) something>:
https://commons.wikimedia.org/wiki/File:Catania_-_Chiesa_di_San_Sebastiano_-_2023-09-02.jpg
Example API to read claims from page ID 136822337:
https://commons.wikimedia.org/w/api.php?action=wbgetclaims&entity=M136822337
Example file with claim <file depicts (P180) Barack Obama (Q76)>:
https://commons.wikimedia.org/wiki/File:President_Barack_Obama_(cropped).jpg (page ID 53109362)
Example API to read claims from page ID 53109362:
https://commons.wikimedia.org/w/api.php?action=wbgetclaims&entity=M53109362
Example output:
"P180": [
{
"mainsnak": {
"snaktype": "value",
"property": "P180",
"hash": "534f48f874f8846f8693121e1bab2d078a9c5b34",
"datavalue": {
"value": {
"entity-type": "item",
"numeric-id": 76,
"id": "Q76"
},
"type": "wikibase-entityid"
},
"datatype": "wikibase-item"
},
"type": "statement",
"id": "M53109362$64a16f62-48f1-969b-6cf0-167df30ca65e",
"rank": "preferred"
}
],How to save claims
Untested but suggested:
https://commons.wikimedia.org/w/api.php?action=help&modules=wbsetclaimvalue
Tested but probably over-complicated:
https://commons.wikimedia.org/w/api.php?action=help&modules=wbeditentity