Topic on Project:Support desk

Using the &continue parameter

2
Shooshte (talkcontribs)

I am using the wikipedia API to query for a search word, for example by making a GET request to this URL:

https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srprop=snippet&continue=&srsearch=Slovenia

This query returns a total of 51429 hits, but will only display the first 10 results. From reading the documentation on this topic, I gather that to get the next 10 results I should pass in the continue parameter.

The relevant parameters in the API response are here:

continue: {

sroffset: 10,

continue: "-||"

}

So I build my url in the following way:

https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srprop=snippet&continue=-||&srsearch=Slovenia

But the URL returns the same set of results.

What am I doing wrong?

121.214.103.220 (talkcontribs)

You should be merging the content of the continue key into your request. You're only adding part of the content (the continue key within the continue key).

https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srprop=snippet&srsearch=Slovenia&sroffset=10&continue=-||

Reply to "Using the &continue parameter"