Forum Discussion
eissaeva
Contributor
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
richie
4 years agoCommunity Hero
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-context
Cheers,
Rich
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-context
Cheers,
Rich
Related Content
- 2 years ago
- 9 years ago