Ask a Question

Getting different error code for get and post

ajain31044
Frequent Visitor

Getting different error code for get and post

Hello

I am working on an API Specification in Swagger which is behaving in an unknown manner.

 

Request URL: https://api-de.test.com.au/v2/poc/quotes/12345/tc

Request Type : GET

Here 12345 is the id that needs to be passed to fetch info

 

If ID is blank : https://api-de.test.com.au/v2/poc/quotes//tc

I am not getting 404 Resource Not Found

 

Wherein, I have created another API that has a similar type of URL but the API is of type POST, there the status code is returning 404.

My question is why a similar type of URL is getting me a different status code for GET and POST.

1 REPLY 1
KarelHusa
Super Contributor

@ajain31044,

the API implementation is responsible for the behavior of API and HTTP response status codes. GET handler may behave differently from the POST handler.

 

Your assumption that API should respond with HTTP 404 for a non-existing resource is correct, but not all implementations work like that.

 

Best regards,

Karel

 

Karel@apimate.eu
https://apimate.eu
cancel
Showing results for 
Search instead for 
Did you mean: