2.2.7.3.1.1 Example

See Appendix A: Sample Entity Data Model and CSDL Document (section 6) for the sample model and data used in this section.

The example below updates an existing Order entity and rebinds it to Customer with EntityKey value "ALFKI".

HTTP Request:

 PUT /service.svc/Orders(1) HTTP/1.1
 Host: host
 Content-Type: application/json;odata=verbose
 Accept: application/json;odata=verbose
 Content-Length: nnn
  
 {
    "__metadata":{ "uri": "Orders(1)" },
    "OrderID": 1,
    "ShippedDate": "\/Date(872467200000)\/",
    "Category" : { __metadata: {uri:"/Customers('ALFKI')" } }
 }

HTTP Response:

 HTTP/1.1 204 No Content
 Date: Fri, 12 Dec 2008 17:17:11 GMT
 Content-Length: nnn
 DataServiceVersion: 1.0
 ETag: W/"X'000000000000FA01'"