HTTP Location Header

I came across this blog post today about using the HTTP Location Header in REST API responses when creating a resource. I have been doing Web development now since 2008 and in all that time I have never actually seen anyone use this header on any of their endpoints.

That being said it makes a lot of sense, traditionally when I would create a new resource I would return the json for that object back in the response so the caller could pull the ID out of the object, but this seems like a better way to do it, as now you could just return your 200 like normal and set this header and not have to send the response body back when the caller knows what they just sent you.

So as is the purpose of this blog I share this partly just so I can refer to it myself to use in the future, but also to draw more attention to it for others as it seems like a great idea, and like the correct way to design your APIs. I also appreciated that they called it Polite HTTP API design, they are much better on their blog titles than I am, as that is a pretty good way to get some attention.