How does the Wiki API handle continues

How does the Wiki API handle continues


I’m trying to use the Wiki API to continue a search by pushing a button. I’ve got the page written out so far on:

The current API query gets me what I need to populate 10 buttons that can be clicked to open a new tab with the corresponding Wikipedia page. However, there are more options to search through and what the user wants may not be listed in the top ten pages. I’ve been doing some research on this page: but I can’t decipher what is required to perform a continue.


That page isn’t what you want to use. It describes a way to manipulate searches for categories. If you go to the MediaWiki sandbox and enter the parameters you’re using, you’ll see some nifty options. Here’s an example.

All I’ve done here is set the srlimit parameter to the maximum (500). That’ll return a maximum of 500 results, far more than practical (for Wikipedia’s sake, you should set this to something more practical, like 50). If you really wanted to do pagination for some reason, you could use the sroffset parameter, but this involves much more logic on your part as you’ll need to store the last limit and increment the next search’s limit.


I’m fine w/ srlimit=10, I only have 10 buttons for the sake of keeping it compact while still being functional. What I want is an API call that translates into “Give me the next 10 elements in the search” so I can populate the buttons with new values/links.


Solved it, here’s the URL call I used for the API:" + (document.getElementById("search_input").value) + "&srwhat=text&srprop=timestamp&prop=info&inprop=url&origin=*&continue=" + current_result.continue.continue + "&sroffset=" + current_result.continue.sroffset

search_input is the input field in my HTML that processes the user input, current_result is a member variable that keeps a record of the results of the API calls to reference the continue section of the JSON. The continue= section requires the continue variable from the JSON and the sroffset requires the sroffset as well.