0

I am writing a Web API application and I have a particular POST method which just pushes a message in to a database in server side.

I do not want to send back the id of the newly created entry in the database.

Just want to send the client that the request is success

What is the HTTP CODE that should be returned in this case ?

HTTP 200 OR HTTP 201 ?

EDIT:

Googled about status code

http 200 means ok and http 201 means created.

Here i am creating a resource but dont want to send the id of the newly created resource. What should be the return code in this case ?

1 Answer 1

4

The HTTP RFC states that a body SHOULD be returned for 201:

The response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate

If you do not want to specify a body you should return "204 No Content".

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

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.