Ask a Question

what is the meaning of '${Request 1#Response}'?

eissaeva
Contributor

what is the meaning of '${Request 1#Response}'?

Hi Community

 

https://support.smartbear.com/readyapi/docs/testing/scripts/samples/compare-xml.html

 

In above explanation, what is the meaning of '${Request 1#Response}'? Can you please provide an example 

 

Is there similar script for compare json documents?

13 REPLIES 13

@eisseava,
If your service doesn't provide XML response, then one have to write some to do the conversion.
By the way, why you need to convert json to XML?




Regards,
Rao.

Changed response header to accept application/xml in both requests and followed the instructions but this did not work

Attaching screenshot of the error and my code sample

Hi Rao, 

Yes, I would like to know  how to compare JSON responses (actual vs expected) but I was only able to find below (comparing xml documents)

 

https://support.smartbear.com/readyapi/docs/testing/scripts/samples/compare-xml.html

 

Any help on how to compare json responses in a similar manner would appreciate

My requirement is not just to print out the actual / expected but to print out their differences in groovy

 

Thanks,

Hey @eissaeva,

Im sorry i think ive confused you. Im not saying change the 'Response' string in the parameter to 'Accept' to change your requests response from json to xml.

What i mean is, you dont need any groovy script at all to change it.

On the request that returns the json payload, add a header called 'Accept'
The value you need to specify on the 'Accept' header is 'application/json'. This will change the datatype of the request's response payload from json to xml.

The 'Accept' header is a standard HTTP header (that you add to a request) that allows you to change the datatype of the requests response payload.

Im probably not explaining this very well, but if you have a look at the following stackoverflow link, it will explain it.

https://stackoverflow.com/questions/35722586/header-parameters-accept-and-content-type-in-a-rest-con...

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: