4.2.8 Retrieve a Single Entity Exposing an Action by Using the AtomPub Format
The following example illustrates the exchange of messages that is required for a client to retrieve a Company entity with an EntityKey value equal to 1 using the AtomPub format. The server indicates that the returned Company allows an action (Audit) to be invoked against it. Actions are supported only in the OData 3.0 protocol.
Request:
-
GET /service.svc/Company(1) HTTP/1.1 Host: host Accept: application/atom+xml DataServiceVersion: 1.0 MaxDataServiceVersion: 3.0
Response:
-
HTTP/1.1 200 OK Date: Thu, 02 Sep 2010 03:40:29 GMT Content-Type: application/atom+xml;type=entry Content-Length: nnn DataServiceVersion: 3.0 <?xml version="1.0" encoding="utf-8"?> <entry xml:base="http://host/service.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <id>http://host/service.svc/Company(1)</id> <title type="text"/> <updated> 2010-08-28T01:29:11Z </updated> <author> <name /> </author> <link rel="edit" title="Company" href="Company(1)/SampleModel.Company" /> <m:action rel="SampleEntities.Audit" title="Audit" target="Company(1)/SampleEntities.Audit" /> <category term="SampleModel.Company" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <category term="Large" scheme="http://company.com/CompanySize" /> <content type="application/xml"> <m:properties> <d:CompanyID>1</d:CompanyID> </m:properties> </content> </entry>