rest - Create request with POST, which response codes 200 or 201 and content -


Suppose I will write a REST service whose intention is to add a new data item to a system.

I plan to post

  http: // myhost / serviceX / someResources  

Suppose that works, me Which response code should be used? And what content can I return

I am looking at the HTTP response code and looking at these possibilities:

200: Return An entity whose result is description or contains action;

201: Which means the created. Meaning * The request has been completed and as a result a new resource is being created, the reply to the newly created resource can be referenced by Uri (s), in which the location header field is the most unique URI for the resource given. The response will include an entity consisting of resource features and location (location) from which user or user agent can choose one of the most suitable. The unit format is specified by the media type given in the content-type header area. The latter looks more with the HPP spec, but I am not quite clear that

The response will include an entity that has a list of resource specifications and location ( S)

This means.

Recommendations? Interpretations?

This is just a colon delimited key-value

< P> tag: "Exxon"

This can be any type of text data - I usually include a JSON string with the identifier of the created object, even with the ease of testing it is also worthwhile. Is included

  itg: "{ID: 1234, Yuri: 'http://domain.com/comments/1234', type: 'comment'}"  

In this example, identify the identifier, Yuri, and the item Car "resource characteristics and location."


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -