Check us out! We now have 3 working endpoints, but one has a big issue. The POST
still returns a text string as its response. Even if you don’t know what
it should return, that’s embarassing. Come on, we can do better!

After creating a resource, one great option is to return a representation
of the new resource. Use the serializeProgrammer to get JSON and
put it into the Response:

That’s just there for convenience, but it cuts down on some code. If your
framework or application doesn’t have anything like this, create a class
or function to help with this: it will go a long way towards following our
favorite motto: be consistent.

By the way, how do I know these rules, like that a 201 response should have
a Location header or that it should return the entity body? These guidelines
come from the IETF and the W3C in the form of big technical documents called RFC’s.
They’re not always easy to interpret, but sometimes they’re awesome. For example,
if you google for httpstatus201 you’ll find the famous RFC 2616,
which gives us the details about the 201 status code and most of the underlying
guidelines for how HTTP works.

I’ll help you navigate these rules. But as we go, try googling for answers
and seeing what’s out there. Some RFC’s, like 2616, are older and well adopted.
Others are still up for comment and being interpreted. Some of which we’ll cover
later.

Leave a comment!

2016-03-14weaverryan

Hey Scott! It's working again - we had a temporary video outage because our video host (Vimeo) themselves had an outage. Better now - sorry about that!

2016-03-14Scottie Gutman

There is an error: The video could not be loaded, either because the server or network failed or because the format is not supported.