i’m here to ask you if there’s a way in Katalon Studio to store in a variable a dynamic string that is generated in the response of a rest API (POST) in HTML format. I have to use the saved string in the body of another request. How can i do? I know it can be done with some code in script mode but don'know exactly how. Thank You
WS.sendRequest()
returns ResponseObject
.
You can then use the built-in JsonSluper.parseText()
on response.getResponseBodyContent()
to get a Map
out of the response body.
The code for that looks something like this:
final ResponseObject response = WS.sendRequest(yourRequestTestObject);
final String yourValue = new JsonSlurper()
.parseText(response.getResponseBodyContent())
.yourKey // replace with the key of the response data you're trying to get
Let me know if you have any questions on this, and I will try my best to help you!