4.4.1 Update a Relationship by Using the AtomPub Format

The following example illustrates the exchange of messages that is required for a client to update the association between the Order entity with EntityKey value 1 and its associated Customer. This example binds the Order 1 to Customer "ASDFG" by using the AtomPub format.

HTTP Request:

 PUT /service.svc/Order(1)/SampleModel.Customer/$links/Customer HTTP/1.1
 Host: host
 Content-Type: application/atom+xml
 Content-Length: nnn
 DataServiceVersion: 1.0
 MaxDataServiceVersion: 1.0
 <uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://host/service.svc/Customer('ASDFG')</uri> 

HTTP Response:

 HTTP/1.1 204 No Content
 Date: Fri, 12 Dec 2008 17:17:11 GMT
 DataServiceVersion: 1.0