Getting a 406 Status code in Ready API 2.2.0 ver, while it works completely fine in Rest client and Postman, Please see the detail of the error message and provide your expert opinion, or the solution when you came across with the same problem
<Fault xmlns="https://xxxx-uat.sd.com/api/v2/movies">
<errors>
<e>
<detail>The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.</detail>
<status>406</status>
<title>Not Acceptable</title>
</e>
</errors>
</Fault>
I don't understand why Ready API giving me this error, while using the same information (url, method, auth code, header etc.) in Rest client and Post it works fine. Can someone please help and guide me how to fix this issue.
I'm using Ready API 2.2.0 and its a paid version.
Thanks,
API_Tester
Hi,
Thank you for your post. To find the cause of the issue, compare a successful (or expected) raw request with a raw request from ReadyAPI.
To get a raw request in ReadyAPI, please switch to the Raw tab on the left side of the Request Editor.
To get a raw request which was sent from a Rest client and Postman you can use Fiddler (http://www.telerik.com/download/fiddler) which is a free tool to capture HTTP(S) traffic.
I compared the RAW Request in both, ReadyAPI and Postman and they both looks the same just besides the Header information.
Method: Get
Raw Request in Ready API:
Get https://url
Accept-Encoding: gzip,deflate
Authorization: Bearer
Content-Type: application/vnd.api+json
Content-Type: application/json
Content-Length: 0
Host: domain-uat.sdvi.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0
Raw Request in Postman:
Get https://url
Authorization:Bearer INDdCRdJ/XXXXXXXXXXXXXXXXXXX+
Content-Type:application/vnd.api+json
Response for ReadyAPI: still the same as below
HTTP/1.1 406 NOT ACCEPTABLE
Server: nginx
Date: Wed, 10 Jan 2018 02:47:31 GMT
Content-Type: application/json
Content-Length: 297
Connection: keep-alive
{
"errors": [
{
"detail": "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.",
"status": "406",
"title": "Not Acceptable"
}
]
}
Response for Postman: 201, OK
Now what you/ anyone else suggest?
Thanks
How do you add this header: Content-Type: application/vnd.api+json ?
Try to change the Media Type for the request from application/json to application/vnd.api+json.
I followed your instruction and still the same results. Attaching a screen shot for your review and see if that can help you to see what I'm facing.
Thanks,
Hi,
Then, we need to compare the Raw requests once again. Does the new request include only one Content-Type header?
Another header that can affect is the Accept-Encoding header. To remove this header from the request un-check the Response Compression box in Preferences->HTTP Settings.
Hi Nastya,
Thanks for taking the time and helping me out. Appreciated!!
So I followed your instructions and made those changes in the tool preferences, but unfortunately I still see the same results.
FYI- the screen shot is attached.
Thanks.
Hi,
Thank you for following my steps. Please open a new support case here: https://support.smartbear.com/message/?prod=ReadyAPI and provide Support Team with the all the required information.
Subject | Author | Latest Post |
---|---|---|