On 2018-01-26 09:16, Victor Shepelev wrote:
Is there a way to tell actually non-existent files from files that are included from commons, through API? Or "just check on commons, in case it is there" is the only way?
You can add &prop=imageinfo to the query:
Files that are loaded from Commons will have the property `"imagerepository": "shared"`: https://en.wikipedia.org/w/api.php?action=query&titles=File:Logo_of_the_...
Files that are uploaded locally will have `"imagerepository": "local"`: https://en.wikipedia.org/w/api.php?action=query&titles=File:Example.jpg&...
Files that are actually missing will have `"imagerepository": ""`: https://en.wikipedia.org/w/api.php?action=query&titles=File:Does%20not%2...
prop=imageinfo also provides some other information about the files, if you add additional options. See https://www.mediawiki.org/wiki/API:Imageinfo .