REST データ・サービスでは、エンティティー・コレクションやプロパティーなど、エンティティー以外のものも取得できます。
RetrieveEntitySet 要求を使用して、クライアントで eXtreme Scale エンティティーのセットを取得できます。エンティティーは、応答ペイロードで、Atom Feed Document または JSON 配列として表されます。 WCF Data Services で定義されている RetrieveEntitySet プロトコルの詳細については、MSDN: RetrieveEntitySet Request を参照してください。
以下の RetrieveEntitySet 要求の例では、Customer('IBM') エンティティーに関連付けられたすべての Order エンティティーを取得します。 この例では、5000 および 5001 の Order のみが表示されます。
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"}}}]}
RetrievePrimitiveProperty 要求を使用して、eXtreme Scale エンティティー・インスタンスのプロパティーの値を取得できます。応答ペイロードで、プロパティーの値は、AtomPub 要求の場合は XML フォーマットとして、JSON 要求の場合は JSON オブジェクトとして表されます。 RetrievePrimitiveProperty 要求の詳細については、MSDN: RetrievePrimitiveProperty Request を参照してください。
以下の RetrievePrimitiveProperty 要求の例では、Customer('IBM') エンティティーの contactName プロパティーを取得します。
AtomPub
<contactName xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
John Doe
</contactName>
JSON
RetrieveValue 要求の詳細については、MSDN: RetrieveValue Request を参照してください。
以下の RetrieveValue 要求の例では、Customer('IBM') エンティティーの contactName プロパティーの未加工値を取得します。
RetrieveLink 要求を使用して、対 1 アソシエーションまたは対多アソシエーションを表すリンクを取得できます。 対 1 アソシエーションの場合、リンクはある eXtreme Scale エンティティー・インスタンスから別のエンティティー・インスタンスに張られ、そのリンクは応答ペイロードで表されます。対多アソシエーションの場合、リンクはある eXtreme Scale エンティティー・インスタンスから、指定した eXtreme Scale エンティティー・コレクション内の他のすべてのエンティティー・インスタンスに張られ、応答は応答ペイロードでリンクのセットとして表されます。RetrieveLink 要求の詳細については、MSDN: RetrieveLink Request を参照してください。
以下に、RetrieveLink 要求の例を示します。 この例では、エンティティー Order(orderId=5000,customer_customerId='IBM') とその Customer 間のアソシエーションを取得します。 応答では、Customer エンティティー URI が示されます。
AtomPub
<?xml version="1.0" encoding="utf-8"?>
<uri>http://localhost:8080/wxsrestservice/restservice/
NorthwindGrid/Customer('IBM')</uri>
JSON
RetrieveServiceMetadata 要求を使用して、概念スキーマ定義言語 (CSDL) 文書を取得できます。この文書には、eXtreme Scale REST データ・サービスに関連したデータ・モデルが記述されています。RetrieveServiceMetadata 要求の詳細については、MSDN: RetrieveServiceMetadata Request を参照してください。
RetrieveServiceDocument 要求を使用して、eXtreme Scale REST データ・サービスによって公開されたリソースのコレクションが記述されたサービス文書を取得できます。RetrieveServiceDocument 要求の詳細については、MSDN: RetrieveServiceDocument Request を参照してください。