I'm currently implementing a RESTful API (nothing serious, just for a blog engine i'm developping for fun) and i've some questions about HTTP status compatibility.
To create a new blog post i have to do a POST request, if every thing goes fine, the post is created and then returned in the format corresponding to the request.
I read on this page from wikipedia about 200 OK
status that
In a POST request the response will contain an entity describing or containing the result of the action
Okay. But then there is the 201 Created
status:
The request has been fulfilled and resulted in a new resource being created.
So my question is: when a POST request is successful and a new blog post is created wan i send back these two http status code or only one at a time is allowed?
I didn't get this info from the RFC, thought i didn't read it entirely.
I'm thinking that only one HTTP status at a time is allowed but then which one should i use?
EDIT (new question): What if the action is editing an existing blog post? I have a PUT request on a URI and this time i'll have to send back 200 OK
and then a Location:
header too? Because this location will be exactly the same as the URI of the PUT request, except that it should be a GET request, is that okay?