since there is not a lot of information, e.g. about the response structure, I went and created a solution for the open library API, this here: https://openlibrary.org/developers/api
So "start" represents the current page/offset, "numFound" the total amount, "docs/title" is the value we want to grab. The project looks like this:
The script in "script" looks like this:
import com.eviware.soapui.support.XmlHolder
import net.sf.*
import net.sf.json.*
import net.sf.json.groovy.*
// here is a list of unique entries we expect to find
// we left out almost all titles on purpose
def uniqueTitles = ["Hobbit", "The Hobbit", "Untangling Tolkien"]
def missedTitles = [] // a list of titles we do not have in our uniqueTitles list, e.g. should include "Der Hobbit" or "El Hobbit" etc.
//since we did NOT fire any requests till now, everything is set to 0
def numFound = 0
def start = -1 // set to -1 since groovy has no do .. while, at least not in the current version used here?
def docsFound = 0
def pageCount = 1 //page count starts with 1 NOT 0
def request = context.testCase.testSuite.getTestCaseByName('request').getTestStepByName('request')
def params = request.getHttpRequest().getParams()
params.getProperty('q').value = 'hobbit' // search for hobbit, we should find around 290 entries
params.getProperty('page').value = pageCount // start with first page
//request pages until we found every entry
while((start + docsFound) < numFound) {
//request page x and read response
request.run(null, context)
def response = request.testRequest.response.contentAsString
def jsonSlurper = new JsonSlurper().parseText(response)
//get book titles
def titles = jsonSlurper.docs.collect{ it.title}
titles.removeAll(uniqueTitles)
if(!titles.isEmpty()) {
missedTitles.addAll(titles)
}
//get all necessary params to check if we still have to request further entities
numFound = Integer.valueOf(jsonSlurper.numFound)
start = Integer.valueOf(jsonSlurper.start)
docsFound = Integer.valueOf(jsonSlurper.docs.size())
params.getProperty('page').value = ++pageCount
}
//all titles we defined at the start
log.info "${uniqueTitles.size()}: unique titles: ${uniqueTitles}"
//all titles that we found but were NOT present in uniqueTitles
log.info "${missedTitles.size()}: missed titles: ${missedTitles}"
log.info("done")
The output, at the end, after the script has run, should look something like this:
Forgot to mention, now you can go over uniqueTitles and missedTitles to compare the entries and do further checks/corrections depending on what exactly you need.