While statement in web service request

Hello guys,

I’m tying to make while statement in PUT Request. I made everything well, but I want to know if it is possible to somehow get only statementIds, count them if every statementId is different. This is my script.

WS.sendRequest(findTestObject('Object Repository/PUT_Count'))

RequestObject request_object = findTestObject('PUT_Count')

String startDate = "2018-02-02"
String endDate = "2019-01-01"
boolean inEquivalent = false

while(GlobalVariable.accountId < 5) {
	request_object.setRestUrl(String.format(request_object.getRestUrl(), GlobalVariable.accountId, startDate, inEquivalent))

	ResponseObject response = WS.sendRequestAndVerify(request_object)

	WS.verifyResponseStatusCode(response, 200)

	int statusCode = response.getStatusCode()

	String bodyContent = response.getResponseBodyContent()

	System.out.println((('Status Code: ' + statusCode) + ':') + bodyContent)

Output is : Status Code: 200:{“statementId”:“11dbfd2f-3d30-493c-b41a-c40a83e41269”,“accountId”:123,“accountIban”:“12345”,“ccy”:“One”,“startDate”:“2018-12-10”,“endDate”:“2019-01-09”,“startBalance”:100.0,“endBalance”:1000.0,“startPointer”:“0094230492304923090Anffjle39440583490434rieklfrlfkjedtu8er9t7548684568t9fkgmndflkgr5908yt546”}
I made for only 5 requests and manually i can check that statementId are different, but when I will make for 100 or more it will be hard to manually check it.

Use Json Slurper to parse the response into a Map and extract any key you need from it, see: