3 ms·
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
by untothebreach 14y ago
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.
- asthasr 14y agoThis 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)
- untothebreach 14y agoyes, I know I have read somewhere that this is "recommended" for REST apis, but I'll be damned if I can find the source.
- asthasr 14y agoThis is the pattern that's recommended in Thomas Erl's SOA with REST book. (http://www.amazon.com/dp/0137012519 http://www.amazon.com/dp/0137012519)