What should I reply PUT request?

What should I reply PUT request?

If a new resource has been created by the PUT API, the origin server MUST inform the user agent via the HTTP response code 201 (Created) response and 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.

Should I put my response body?

In fact the response body is not mentioned at all in relation to a PUT. It only states 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.

CAN PUT request have response?

If the target resource does not have a current representation and the PUT request successfully creates one, then the origin server must inform the user agent by sending a 201 ( Created ) response.

Does put return response?

Though PUT is idempotent, we shall not cache it’s response. Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource.

Should POST return 200 or 201?

Successful. The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed. A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).

How to insert a record using an external ID?

If you have an object that references another object using a relationship, you can use REST API to both insert or update a record and also reference another object using an external ID. The following example creates a record and associates it with a parent record via external ID. It assumes the following:

What should a restful’put’operation return?

PUT should never return a body, but must return a response code in the header. Just choose 200 if it was successful, and 4xx if not. There is no such thing as a null return code. Why do you want to do this?

How many records can be created in one request?

In a single request, you can create up to two hundred records. In the request data, you supply the required and optional field values for each record, each record’s type, and a reference ID for each record, and then use the POST method of the resource. The response body will contain the IDs of the created records if the request is successful.

Why is the value of ID omitted from the request?

Because the value of Id is null, it’s omitted from the request. This pattern is useful when you’re writing code to upsert multiple records by different external IDs and you don’t want to request a separate resource. POST using Id is available in API version 37.0 and later. The HTTP status code is 201 (Created).