API talk:Imageinfo

Documentation on results format???
Is there any documentation on how to interpret the results of this query? The deeply nested JSON that results is rather opaque. More generally, the query side of the API seems well-documented, but there seems to be very little description of what comes back. Am I missing something? Thanks. Johndburger (talk) 01:46, 24 August 2015 (UTC)


 * No, unfortunately, you're not missing anything. Because many of the queries are fairly obvious when it comes to results, there's been no particular pressure to document things. When it comes to the larger structures like this or API:Siteinfo, it can be problematic. I've started to add results when I have time, but haven't documented ImageInfo yet. I've done a lot of work on it for a bot that I'm (very slowly) working on, so if you have any questions, I'll be happy to help if I can. By and large, only the metadata-related stuff has really deep nesting, and as much of it doesn't come directly from MediaWiki, its structure is pretty arbitrary. I believe MW tries to standardize the extmetadata output into a single, unnested collection, but the other two contain more info, as I recall. Anything else you need to know? – Robin Hood  (talk)  02:12, 24 August 2015 (UTC)


 * Oops, just saw this. I'm just curious about some of the nesting. For instance, in the last example on this page, why is "pages" a dictionary with a single key, usually (but not always) -1? Thanks for your reply. Johndburger (talk) 03:27, 17 September 2015 (UTC)


 * "Pages" is generally a dictionary with the page id being the key, and the various page data as the value. For pages that don't exist, or where there's some other problem with them that they don't have an id, they're assigned a sequential negative number to act as a unique id. In this case, I believe the file actually comes from Commons, so doesn't really exist on WP, even though it might look that way when you use the regular UI. – Robin Hood  (talk)  03:42, 17 September 2015 (UTC)