2.2.7.3.2 UpdateComplexType Request

The purpose of the UpdateComplexType request is to enable the value of a ComplexType instance to be updated. AtomPub, as specified in [RFC5023], does not define operations on subcomponents of an entry resource. As such, this request type is not based on an AtomPub-defined [RFC5023] request.

An UpdateComplexType request MUST use the HTTP PUT, PATCH, or MERGE method, as specified in PATCH/MERGE (section 2.2.4.1). Additionally, the URI specified by the client in the HTTP request line MUST be a valid data service URI, that identifies a ComplexType instance, as specified in URI Format: Resource Addressing Rule (section 2.2.3) .

The payload of the request MAY be formatted using the XML, JSON, or Verbose JSON format, according to the rules defined in Complex Type (section 2.2.6.5.1), Complex Value ([ODataJSON4.0] section 7.2), and Complex Type (section 2.2.6.3.4), respectively. A server accepting a request of this type using the PUT method MUST replace the value of the ComplexType addressed via the request URI with the value provided in the payload. A server accepting a request of this type using the MERGE or PATCH method MUST merge the property values of the ComplexType addressed via the request URI with the property values that are provided in the payload, as specified in PATCH/MERGE (section 2.2.4.1).

If the UpdateComplexType request is successful, the response in OData 1.0 and OData 2.0 MUST have a 204 response code, as specified in [RFC2616], and have 0 bytes in the response body, unless a Prefer header (section 2.2.5.9) has been specified to request content. When an OData 1.0 or OData 2.0 request contains a Prefer header value that requests content or when OData 3.0 is used, the response MAY have a 200 response code, as specified in [RFC2616], and a response body that MUST be formatted the same as a response body to an RetrieveComplexType request (section 2.2.7.2.3).

If the UpdateComplexType request is not successful (for example, if an error occurs during request processing), the response MUST be formatted according to Error Response (section 2.2.8.1).

The syntax of an UpdateComplexType request is defined as follows:

 updateCT-Req            = updateCT-ReqLine
                           updateCT-ReqHeaders
                           CRLF
                           updateCT-ReqBody
  
 updateCT-ReqLine        = "PUT" / "MERGE" / "PATCH"
                           SP entityTypeInstanceCTUri updateCT-QueryOps
                           SP HTTP-Version
                           CRLF
  
 updateCT-ReqHeaders     = [DataServiceVersion]        ; see section 2.2.5.3
                           [MaxDataServiceVersion]     ; see section 2.2.5.7
                           [If-Match]                  ; see section 2.2.5.5
                           [Content-Type]              ; see section 2.2.5.2
                           [Prefer]                    ; see section 2.2.5.9
                           *(HTTP-Header-Types)
  
 updateCT-ReqBody        = <Complex value formatted in JSON as per [ODataJSON4.0]
                            section 7.2>
                           / <ComplexType value formatted in XML as
                              per section 2.2.6.5.1>
                           / (begin-object entityCTInVJson end-object)
                              ; see section 2.2.6.3.4
  
 entityTypeInstanceCTUri = <Any Resource Path identifying a Complex Type instance>
                                 ; see section 2.2.3 and section 2.2.3.5 -- URI3
  
 updateCT-QueryOps       = ["?" customQueryOption *("&" customQueryOption)]

The syntax of a response to a successful UpdateComplexType request is defined as follows:

 updateCT-Resp           =  Status-Line                 ; see [RFC2616] section 6.1.1
                            updateCT-RespHeaders
                            CRLF
                            [updateCT-RespBody]
  
 updateCT-RespHeaders    =  DataServiceVersion          ; see section 2.2.5.3
                            [ETag]                      ; see section 2.2.5.4
                            [Preference-Applied]            ; see section 2.2.5.10   
                            *(HTTP-Header-Types)
  
 updateCT-RespBody        =  <Complex value formatted by using JSON as per [ODataJSON4.0]
                             section 7.2>
                             /<ComplexType property value formatted by using XML as per
                               section 2.2.6.5.1>
                             /(begin-object
                              quotation-mark "d" quotation-mark
                              name-seperator
                              (entityCTInVJson / entityCTInVJson2)
                              end-object)
                              ; see section 2.2.6.3.4