Ask a Question

Getting different error code for get and post

Frequent Visitor

Getting different error code for get and post


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


Request URL:

Request Type : GET

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


If ID is blank :

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.

Super Contributor


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,

Showing results for 
Search instead for 
Did you mean: