Mit dem REST-Datenservice können Sie mehr als nur Entitäten, wie z. B. Entitätssammlungen und Eigenschaften, abrufen.
Eine RetrieveEntitySet-Anforderung kann von einem Client verwendet werden, um eine Gruppe von eXtreme-Scale-Entitäten abzurufen. Die Entitäten werden als Atom Feed Document oder JSON-Feldgruppe in den Nutzdaten der Antwort dargestellt. Weitere Einzelheiten zu dem in WCF Data Services definierten Protokoll "RetrieveEntitySet" finden Sie auf der Webseite MSDN: RetrieveEntitySet Request.
Die folgende RetrieveEntitySet-Beispielanforderung ruft alle Order-Entitäten ab, die der Entität "Customer('IBM')" zugeordnet sind. Hier werden nur die Bestellungen (Order) 5000 und 5001 gezeigt.
AtomPub
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base = "http://localhost:8080/wxsrestservice/restservice"
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">
<title type = "text">Order</title>
<id>http://localhost:8080/wxsrestservice/restservice/NorthwindGrid/
Order</id>
<updated>2009-12-16T22:53:09.062Z</updated>
<link rel = "self" title = "Order" href = "Order"/>
<entry>
<category term = "NorthwindGridModel.Order" scheme = "http://
schemas.microsoft.com/
ado/2007/08/dataservices/scheme"/>
<id>http://localhost:8080/wxsrestservice/restservice/
NorthwindGrid/Order(orderId=5000,customer_customerId=
'IBM')</id>
<title type = "text"/>
<updated>2009-12-16T22:53:09.062Z</updated>
<author>
<name />
</author>
<link rel = "edit" title = "Order" href = "Order(orderId=5000,
customer_customerId='IBM')"/>
<link rel = "http://schemas.microsoft.com/ado/2007/08/
dataservices/related/customer"
type = "application/atom+xml;type=entry"
title = "customer" href = "Order(orderId=5000,
customer_customerId='IBM')/customer"/>
<link rel = "http://schemas.microsoft.com/ado/2007/08/
dataservices/related/orderDetails"
type = "application/atom+xml;type=feed"
title = "orderDetails" href = "Order(orderId=5000,
customer_customerId='IBM')/
orderDetails"/>
<content type="application/xml">
<m:properties>
<d:orderId m:type = "Edm.Int32">5000</d:orderId>
<d:customer_customerId>IBM</d:customer_customerId>
<d:orderDate m:type = "Edm.DateTime">2009-12-16T19:
46:29.562</d:orderDate>
<d:shipCity>Rochester</d:shipCity>
<d:shipCountry m:null = "true"/>
<d:version m:type = "Edm.Int32">0</d:version>
</m:properties>
</content>
</entry>
<entry>
<category term = "NorthwindGridModel.Order" scheme = "http://
schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<id>http://localhost:8080/wxsrestservice/restservice/
NorthwindGrid/Order(orderId=5001, customer_customerId='IBM')
</id>
<title type = "text"/>
<updated>2009-12-16T22:53:09.062Z</updated>
<author>
<name />
</author>
<link rel = "edit" title = "Order" href = "Order(orderId=5001,
customer_customerId='IBM')"/>
<link rel = "http://schemas.microsoft.com/ado/2007/08/
dataservices/related/customer"
type = "application/atom+xml;type=entry"
title = "customer" href = "Order(orderId=5001,
customer_customerId='IBM')/customer"/>
<link rel = "http://schemas.microsoft.com/ado/2007/08/
dataservices/related/orderDetails"
type = "application/atom+xml;type=feed"
title = "orderDetails" href = "Order(orderId=5001,
customer_customerId='IBM')/orderDetails"/>
<content type="application/xml">
<m:properties>
<d:orderId m:type = "Edm.Int32">5001</d:orderId>
<d:customer_customerId>IBM</d:customer_customerId>
<d:orderDate m:type = "Edm.DateTime">2009-12-16T19:50:
11.125</d:orderDate>
<d:shipCity>Rochester</d:shipCity>
<d:shipCountry m:null = "true"/>
<d:version m:type = "Edm.Int32">0</d:version>
</m:properties>
</content>
</entry>
</feed>
JSON
{"d":[{"__metadata":{"uri":"http://localhost:8080/wxsrestservice/
restservice/NorthwindGrid/Order(orderId=5000,
customer_customerId='IBM')",
"type":"NorthwindGridModel.Order"},
"orderId":5000,
"customer_customerId":"IBM",
"orderDate":"\/Date(1260992789562)\/",
"shipCity":"Rochester",
"shipCountry":null,
"version":0,
"customer":{"__deferred":{"uri":"http://localhost:8080/
wxsrestservice/restservice/NorthwindGrid/Order(orderId=
5000,customer_customerId='IBM')/customer"}},
"orderDetails":{"__deferred":{"uri":"http://localhost:8080/
wxsrestservice/restservice/NorthwindGrid/Order(orderId=
5000,customer_customerId='IBM')/orderDetails"}}},
{"__metadata":{"uri":"http://localhost:8080/wxsrestservice/
restservice/NorthwindGrid/
Order(orderId=5001,
customer_customerId='IBM')",
"type":"NorthwindGridModel.Order"},
"orderId":5001,
"customer_customerId":"IBM",
"orderDate":"\/Date(1260993011125)\/",
"shipCity":"Rochester",
"shipCountry":null,
"version":0,
"customer":{"__deferred":{"uri":"http://localhost:8080/
wxsrestservice/restservice/NorthwindGrid/Order(orderId=
5001,customer_customerId='IBM')/customer"}},
"orderDetails":{"__deferred":{"uri":"http://localhost:8080/
wxsrestservice/restservice/NorthwindGrid/Order(orderId=
5001,customer_customerId='IBM')/orderDetails"}}}]}
Eine RetrievePrimitiveProperty-Anforderung kann verwendet werden, um den Wert einer Eigenschaft einer eXtreme-Scale-Entitätsinstanz abzurufen. Der Eigenschaftswert wird im XML-Format für AtomPub-Anforderungen und als JSON-Objekt für JSON-Anforderungen in den Nutzdaten der Antwort dargestellt. Weitere Einzelheiten zur RetrievePrimitiveProperty-Anforderung finden Sie auf der Seite MSDN: RetrievePrimitiveProperty Request.
Die folgende RetrievePrimitiveProperty-Beispielanforderung ruft die Eigenschaft "contactName" der Entität "Customer('IBM')" ab.
AtomPub
<contactName xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
John Doe
</contactName>
JSON
Weitere Einzelheiten zur RetrieveValue-Anforderung finden Sie auf der Webseite MSDN: RetrieveValue Request.
Die folgende RetrieveValue-Beispielanforderung ruft den unaufbereiteten Wert der Eigenschaft "contactName" der Entität "Customer('IBM')" ab.
Eine RetrieveLink-Anforderung kann verwendet werden, um die Verbindungen abzurufen, die eine :1-Assoziation oder :N-Assoziation darstellen. Bei der :1-Assoziation verläuft die Verbindung von einer eXtreme-Scale-Entitätsinstanz zu einer anderen, und die Verbindung wird in den Nutzdaten der Anforderungen dargestellt. Bei der :N-Assoziation verlaufen die Verbindungen von einer eXtreme-Scale-Entitätsinstanz zu allen anderen in einer bestimmten eXtreme-Scale-Entitätssammlung, und die Antwort wird als Gruppe von Verbindungen in den Nutzdaten der Antwort dargestellt. Weitere Einzelheiten zur RetrieveLink-Anforderung finden Sie auf der Webseite MSDN: RetrieveLink Request.
Im Folgenden sehen Sie ein RetrieveLink-Beispielanforderung. In diesem Beispiel wird die Assoziation zwischen der Entität "Order(orderId=5000,customer_customerId='IBM')" und dem zugehörigen Customer (Kunde) abgerufen. Die Antwort enthält den URI der Entität "Customer".
AtomPub
<?xml version="1.0" encoding="utf-8"?>
<uri>http://localhost:8080/wxsrestservice/restservice/
NorthwindGrid/Customer('IBM')</uri>
JSON
Eine RetrieveServiceMetadata-Anforderung kann verwendet werden, um das CSDL-Dokument (Conceptual Schema Definition Language) abzurufen, in dem das Datenmodell beschrieben ist, das dem REST-Datenservice von eXtreme Scale zugeordnet ist. Weitere Einzelheiten zur RetrieveServiceMetadata-Anforderung finden Sie auf der Webseite MSDN: RetrieveServiceMetadata Request.
Eine RetrieveServiceDocument-Anforderung kann verwendet werden, um das Servicedokument abzurufen, in dem die Sammlung der vom REST-Datenservice von eXtreme Scale bereitgestellten Ressourcen beschrieben ist. Weitere Einzelheiten zur RetrieveServiceDocument-Anforderung finden Sie auf der Webseite MSDN: RetrieveServiceDocument Request.