On Thu, Apr 17, 2014 at 4:13 AM, Gilles Dubuc <gilles@wikimedia.org> wrote:When the user opens media viewer, but there are 4 API calls per imageWhen I tried it just now, I saw 6 queries: one to prop=imageinfo to fetch a number of different props, one to meta=filerepoinfo, one to list=imageusage, one to prop=globalusage, and two more to prop=imageinfo to fetch the URLs for two different sizes of the image.
The first four could all be combined into one query (this is an advantage of the batch design of the web API over the much-touted REST model):
https://www.mediawiki.org/w/api.php?action=query&format=json&prop=imageinfo|globalusage&titles=File:Swallow_flying_drinking.jpg&iiprop=timestamp|user|url|size|mime|mediatype|extmetadata&iiextmetadatafilter=DateTime|DateTimeOriginal|ImageDescription|License|LicenseShortName|UsageTerms|LicenseUrl|Credit|Artist|GPSLatitude|GPSLongitude|Categories|Permission&iiextmetadatalanguage=en&guprop=url|namespace&gufilterlocal=1&gulimit=100&meta=filerepoinfon&list=imageusage&iutitle=File:Swallow_flying_drinking.jpg&iunamespace=0|100&iulimit=100
Being able to merge in the last two as well would be bug 54035.Also, getting really offtopic here, "guprop[]=url&guprop[]=namespace" and "&iunamespace[]=0&iunamespace[]=100" that I see in your original queries doesn't actually work; it gives the same results as if guprop and iunamespace are omitted entirely. The API should give a warning about that (filed as bug 64057).
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
_______________________________________________
Ops mailing list
Ops@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/ops