I did try to use the jsonUrl class but the call for this is authenticated and using https, which caused jsonUrl to throw an error so…
I have a json call that returns a list of people like so:
{
“list”: [{
“name”: “Simpson, Bart”,
“personid”: 100121000027,
“room”: 100027
}, {
“name”: “Flintstone, Fred”,
“personid”: 100121000026,
“room”: 100027
}, {
“name”: “Wayne, Bruce”,
“personid”: 100121000020,
“room”: 100027
}]
}
I thought it would be easy to just create a feeder from this return but at runtime I would get an empty feeder error, it seems that the exec which grabbed the data for the feeder ran after the block looking for the feeder.
val persons = new ListBufferMap[String,Any]
exec(http(“Person List”
).post("/person/getList.json")
.headers(headers_json)
.check(status.in(200, 302),
jsonPath("$.list[*]").ofType[Map[String, Any]].findAll.saveAs(“pList”)))
.foreach("${pList}", “person”) {
exec(session => {
val personMap = session(“person”).as[Map[String, Any]]
val personId = personMap(“person_pk”)
persons.append(patientMap)
})
}
// get person details
feed(persons.toArray)
.exec(http(“Person Details”
).get("""/persondetails.json?personId="${personId}""")
.headers(headers_json)
.check(status.in(200, 302)))
So, that too failed. Now I am starting to wonder if I am doing this all wrong. I was hoping to be able to reuse the feeder to drive several more requests that are based on the same id. Is there a way to create a feeder out of a prior request? Is there another way I should be doing this? It seems like it should be a simple thing but it escapes me…
-Gary