Paflow
Paflow

Reputation: 2347

Wikimedia API get generator metadata

I want to get pages from Wikimedia Commons and it seems, that I have still not understand the usage of the Wikimedia API.

I use the following query

https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&format=json&iiprop=url|size|mime|mediatype|extmetadata&iiurlwidth=150&generator=search&gsrsearch=transformation&gsrnamespace=6&gsrlimit=9&gsroffset=0&gsrinfo=totalhits

See in API Sandbox

Which works great, except that I don't get the grsinfo / generator metadata. But I need the total amount of results (totalhits).

Any suggestions?

Upvotes: 0

Views: 183

Answers (1)

Tgr
Tgr

Reputation: 28160

Per the docs,

It should also be noted that generators only pass page titles to the 'real' query, and do not output any information themselves. Setting parameters like gcmprop will therefore have no effect.

If you need the hit count, you'll have to do a normal search API query, manually generate a list of pages from it and query them in a second API request.

Upvotes: 1

Related Questions