2.2.7.3.3 UpdatePrimitiveProperty Request

The purpose of the UpdatePrimitiveProperty request is to enable the value of an EDMSimpleType property on an EntityType 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 UpdatePrimitiveProperty request MUST use either the HTTP PUT, PATCH, or MERGE (as specified in PATCH/MERGE (section 2.2.4.1)) and the URI specified by the client in the HTTP request line MUST be a valid data service URI, as specified in URI Format: Resource Addressing Rules (section 2.2.3), which identifies a property (of type EDMSimpleType) on an EntityType instance (or on one of the ComplexType properties of that EntityType instance).

The payload of the request MAY be formatted by using XML, JSON, or Verbose JSON, according to the rules defined in EDMSimpleType Property (section 2.2.6.5.3), Primitive Value ([MS-ODATAJSON] section 2.1.17), and EDMSimpleType Property (section 2.2.6.3.8), respectively. A server receiving a request of this type MUST replace the value of the property addressed via the request URI with the property value provided in the payload. The server MUST perform the same behavior whether the request uses the MERGE, PATCH, or PUT method.

If the property addressed is one of the properties which define the EntityKey for the addressed entity, then the request MUST be considered invalid.

If the UpdatePrimitiveProperty 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 includes the updated entity that MUST be formatted the same as a response body to a RetrievePrimitiveProperty request (section 2.2.7.2.4).

If the UpdatePrimitiveProperty 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 UpdatePrimitiveProperty request is defined as follows:

 updatePP-Req            = updatePP-ReqLine
                           updatePP-ReqHeaders
                           CRLF
                           updatePP-ReqBody
  
 updatePP-ReqLine        = "PUT" / "MERGE" / "PATCH"
                           SP entityTypeInstancePropertyUri updatePP-QueryOps
                           SP HTTP-Version
                           CRLF
  
 updatePP-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)
  
 updatePP-ReqBody        = <Primitive value formatted in JSON as per {MS-ODATAJSON]
                            section 2.1.17>
                           / <Property value formatted in XML as per section 2.2.6.5.3>
                           / (begin-object entityPropertyInVJson end-object)
                              ; see section 2.2.6.3.8
  
 entityTypeInstancePropertyUri = ; see section 2.2.7.4.3
  
 updatePP-QueryOps       = ["?" customQueryOption *("&" customQueryOption)]

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

 updatePP-Resp           =  Status-Line                 ; see [RFC2616] section 6.1.1
                            updatePP-RespHeaders
                            CRLF
                            [updatePP-RespBody]
  
 updatePP-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)
 updatePP-RespBody     =  <Primitive value formatted in JSON as per {MS-ODATAJSON]
                           section 2.1.17>
                           / <Property value formatted in XML as per section
                              2.2.6.5.3>
                            / (begin-object
                               quotation-mark "d" quotation-mark
                               name-seperator
                               begin-object
                               (entityPropertyInVJson / entityPropertyInVJson2)
                               end-object
                               end-object)
                               ; see section 2.2.6.3.8