Forum Discussion

API_Tester's avatar
API_Tester
Occasional Contributor
7 years ago

Getting a 406 Status code in Ready API 2.2.0 ver, while it works completely fine in Rest client

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

7 Replies

  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    SmartBear Alumni (Retired)

    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.

    • API_Tester's avatar
      API_Tester
      Occasional Contributor

      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

      • Nastya_Khovrina's avatar
        Nastya_Khovrina
        SmartBear Alumni (Retired)

        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.