Note that there are some explanatory texts on larger screens.

plurals
  1. POCompatibility of HTTP status
    text
    copied!<p>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.</p> <p>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.</p> <p>I read on <a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes" rel="nofollow noreferrer">this page</a> from wikipedia about <code>200 OK</code> status that </p> <blockquote> <p>In a POST request the response will contain an entity describing or containing the result of the action</p> </blockquote> <p>Okay. But then there is the <code>201 Created</code> status:</p> <blockquote> <p>The request has been fulfilled and resulted in a new resource being created.</p> </blockquote> <p>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?</p> <p>I didn't get this info from the <a href="http://tools.ietf.org/html/rfc2616#section-10" rel="nofollow noreferrer">RFC</a>, thought i didn't read it entirely.</p> <p>I'm thinking that only one HTTP status at a time is allowed but then which one should i use?</p> <p><strong>EDIT</strong> (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 <code>200 OK</code> and then a <code>Location:</code> 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?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload