Gatling Pagination testing

Say, I have such json coming from my web service

To get such response, I need to call web service by url:


I will receive paged result, with 20 elements batch,

Each resource will have uri field, which I can use to call resource by ID request


I want to test each of adminunits to be sure, that everything goes fine.
I suppose, I need to have double loop, one for calling /adminunits?offset=startPosition+limit
and another for calling each of 20 resources.

Where can I read documentation for this looping ?)

Maybe asLongAs function can help me - but I din’t found any example on how to use it.

Why not do something like this

val httpProtocol = http

//Get all the uri’s from jsonpath
exec(http (“mybaseurl”)
.check (jsonPath("""$…uri""").findAll.saveAs(“uris”)))

.foreach("${uris}", “uri”) {
exec(http(“get uri”)