How to verify API responses in Katalon Studio


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/verify-api-responses.html

Hi,
I have a json response, as of now I can validate the response by specifying the actually json path , property name and property value. Later if there is a change in the property name or path the script may not work. Hence, I want paramtertize the json path of the element, the property name and property value.

I tried to declare a variable and use that in verification step like assertThat(json.get("’[${pathVariable}]’").toString().equals("’[${pathVariable}]’")) but it’s failing with no property found error.

Is there a way to achieve this?

I am also looking for a solution on the same topic. Please some one help us on this.

1 Like

I am getting the error When try to call any of the methods on the webservice,and parsing the response for the API request error message is “Content is not allowed in prolog”
the call actually succeeds but the reponse is in not in correct format it has this header details displayed at the top of the response xml
Is there a way in Katalon to updated the configuration [BasicHttpBinding.MessageEncoding] property

The details of the errors are below, thanks for any help you guys can offer.
image

Hi,

I’m also looking for something similar to this, did anyone find the solution in the end? My example is I am trying to incorporate a variable in to the following:

WS.verifyElementPropertyValue(response, ‘address.postcode’, ‘’)

I have tried doing the below WS.verifyElementPropertyValue(response, ‘address.postcode’, ‘${GlobalVariable.Postcode’) but no luck. I got the following error message

'Expected element property value ‘${GlobalVariable.Postcode’ is not equal with actual property value ‘BH2 5LT’

The variable value is named Postcode and set to BH2 5LT, so I’m not sure why it isn’t matching up. Any help would be much appreciated.

Thanks