Re:Designing a RESTful API That Doesn't Suck
by untothebreach on Friday March 22, 2013 @09:45AM
(#5422820)
stuffihavemade is correct. Also, generally a POST request is made to some kind of "resource creating" URI, which includes the URI for the newly-created resource in it's response. A PUT request is typically made to the URI of an existing resource.
[ Parent
| on HN ]
Re:Designing a RESTful API That Doesn't Suck
by asthasr on Friday March 22, 2013 @10:56AM
(#5423277)
This is what I've done in APIs I designed. You end up with requests like this:
POST /widgets
Content-Type: application/json
--
{"name": "An example widget", "color": "blue"}
With the response being: 201 CREATED
Location: /widgets/37
--
(no body)
Re:Designing a RESTful API That Doesn't Suck
by untothebreach on Friday March 22, 2013 @11:30AM
(#5423539)
yes, I know I have read somewhere that this is "recommended" for REST apis, but I'll be damned if I can find the source.
Re:Designing a RESTful API That Doesn't Suck
by asthasr on Saturday March 23, 2013 @12:49PM
(#5428782)
This is the pattern that's recommended in Thomas Erl's SOA with REST book. (http://www.amazon.com/dp/0137012519)