Search By Label
GET
request expresses the user's intent to not have any side effects. Naturally, there will always be side effects on the server like log entries for example, but the important distinction here is whether the user had asked for a side effect or not.GET
surfaces if you respond with the recommended 201 Created
response for a request where the resource is being created on the server. The next request would result in a different response with status 200 OK
and thus it cannot be cached as is usually the case with GET
requests.The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.
If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem.
409 Conflict
in case an update would result in a different state.{ "orderID":3, "productID":2, "quantity":4, "orderValue":16.60, "links":[ { "rel":"customer", "href":"https://adventure-works.com/customers/3", "action":"GET", "types":["text/xml","application/json"] }, { "rel":"customer", "href":"https://adventure-works.com/customers/3", "action":"PUT", "types":["application/x-www-form-urlencoded"] }, { "rel":"customer", "href":"https://adventure-works.com/customers/3", "action":"DELETE", "types":[] }, { "rel":"self", "href":"https://adventure-works.com/orders/3", "action":"GET", "types":["text/xml","application/json"] }, { "rel":"self", "href":"https://adventure-works.com/orders/3", "action":"PUT", "types":["application/x-www-form-urlencoded"] }, { "rel":"self", "href":"https://adventure-works.com/orders/3", "action":"DELETE", "types":[] }] }