0

If end user not send query parameter then i want to return a message like:

return Response.status(500).entity("If you wish to download whole offerings data send query Param 'timestampForInitialLoad'. If you wish to get offerings after particular date then send query Param as 'lastModifedDate'").build();

What will be HTTP Status code for such message?

Will it be 500 Internal Server Error (well it is not)

or will it be 204 No Content (But content is message itself)

or will it be 200 Success (But call is not correct)

Not able to get from 1XX HTTP Status codes

1
  • 1
    It seems like this should be 4xx, they were missing something in the request. Commented May 6, 2022 at 17:35

3 Answers 3

0

I would say it should be 400 bad request, because you expect the request to have that query parameter.

Sign up to request clarification or add additional context in comments.

Comments

0

What will be HTTP Status code for such message?

404 Not Found would be the usual answer.

4xx, because you are trying to call the client's attention to a problem in the HTTP request (not the handling of the request), and clarifying for general purpose HTTP components that the response body is a representation of an explanation of the error situation (not a representation of the resource).

404, because you are specifically calling attention to the target URI of the HTTP request. 404 also has the advantage that it is heuristically cacheable.

if we have use case where i share some information

Make it part of the response body.

Status codes are metadata of the transfer of documents over a network domain. The details that are specific to your situation belong in the response body.

Consider the case of the web - for such a case, the body typically looks like an HTML document with an explanation of the error, and links/forms to help the user to succeed. But the status code is still 404.

1 Comment

And if we have use case where i share some information. Do we have any such HTTP Status code
0

It should be 400 Bad request as blank request body is a bad request body.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.