3.2.5.3 Executing a Received Insert Request

The directives defined in this section apply when executing a received request of any of the Insert request types defined in Insert Request Types (section 2.2.7.1).

The server MUST validate the HTTP request URI identified as an EntitySet, collection of entities, or a collection of Links, as defined by the data service's data model in Abstract Data Model (section 2.2.1). If this validation fails, a 4xx error response code MUST be returned, as specified in Common Response Codes (section 3.2.8). If the validation succeeds, the server MUST insert the new entity, Media Resource, or Link as appropriate, based on the description in Insert Request Types (section 2.2.7.1).

If an Insert request is received with a null value for a data service resource and the type of that resource is not nullable (as defined by the Entity Data Model associated with the data service) then the server MUST return a 4xx response code, as specified in Common Response Codes (section 3.2.8).

If an Insert request is received with an empty value for a data service resource and the type of that resource does not define an empty state, the server MUST return a 4xx response code, as specified in Common Response Codes (section 3.2.8).<71>

Any inlined content (section 2.2.6.2.6.1) in a request payload MUST be treated as a "deep insert" as specified in InsertEntity Request (section 2.2.7.1.1), inlined content (section 2.2.6.2.6.1), and Deferred Content (section 2.2.6.3.9).

If the request URI does not match associated URIs anywhere in the request payload where URIs are expected, then the request URI takes precedence and the payload SHOULD be treated as if the URIs in it matched the value of the request URI.

A data service MAY alter or ignore any of the values provided in the request payload before performing the insert operation.