Get the value of a REST Response Element and show it in log

Hi folks, I am trying to get an element in the response of a Rest API GET and show it in the log. I am doing this for troubleshooting. I have no problem verifying that the element contents, but the content changes depending on what server is answering from behind a vip.

This should be a simple thing to do, I am just trying to capture particular elements of the response.

I am verifying the response works with:
verifyElementPropertyValue(response, “requestHandler.error”, “null”) and that works fine.

I want to capture the value of (response, “requestHandler.hostname”, “”) but I dont think I can use wildcards.

Any help would be appreciated. We are trying to find an error in a large number of servers.

I have now added:

response = WS.sendRequestAndVerify(findTestObject(‘Query to VIP’))
def slurper = new groovy.json.JsonSlurper()
def result = slurper.parseText(response.getReponseBodyContent())

println result.requestHandler.hostname

I now get this error:
e[31mgroovy.lang.MissingMethodException: No signature of method: com.kms.katalon.core.testobject.ResponseObject.getReponseBodyContent() is applicable for argument types: () values: []e[0;39m
e[31mPossible solutions: getResponseBodyContent()

I am sure this is obvious, any help?

You wrote “getReponseBodyContent”.
This is an obvious typo.
You should write “getResponseBodyContent”.

Thanks you. I am on 3 hours of sleep. Thank you!

Спокойной ночи.