6

I am using Wikipedia API where I get the images of certain string I input. It always returns 10 result but I want more than that approx 50.

https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&format=json&piprop=thumbnail&pithumbsize=500&pilimit=50&generator=prefixsearch&gpssearch=game of thrones

How do I get 50 results?

Termininja
  • 6,620
  • 12
  • 48
  • 49
WISHY
  • 11,067
  • 25
  • 105
  • 197
  • According to the [API description](https://en.wikipedia.org/w/api.php), exactly how you tried it. Apparently the API is broken or the documentation out of date. I recreaded your query in the [API Sandbox](https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=pageimages&generator=prefixsearch&pithumbsize=500&pilimit=50&gpssearch=test) but that doesn't work either. – Manfred Radlwimmer Jun 02 '16 at 06:04
  • It works on sandbox perfectly – WISHY Jun 02 '16 at 06:17

2 Answers2

4

Solved also need to add

&gpslimit=100

enter image description here it should be in the range 1-100

WISHY
  • 11,067
  • 25
  • 105
  • 197
1

By default most of the generators and props used in query action are with limit of 10. Always when you need to increase the limit for your query you have to set the corresponding limit value for all them, because the resulting query limit is equal to smallest of all them.

So, if your query uses generator=geosearch with prop=links|extracts|categories|images and you need 20 results, you must set the limit parameters for geosearch, links, extracts, categories and images to 20.

https://en.wikipedia.org/w/api.php?...&ggslimit=20&pllimit=20&exlimit=20&cllimit=20&imlimit=20

Of course this has to comply with the allowed max limit for each parameter. For example, for extracts the allowed max limit is 20 (default: 1), which means that you can't get more than 20 pages in your final response, although others are more than 20. This also means that in your case above the effect of gpslimit=100 will be the same as gpslimit=50, because pilimit=50.

Termininja
  • 6,620
  • 12
  • 48
  • 49