diff --git a/docs/odata-protocol/odata-protocol.html b/docs/odata-protocol/odata-protocol.html index a935fb04..71e6e0be 100644 --- a/docs/odata-protocol/odata-protocol.html +++ b/docs/odata-protocol/odata-protocol.html @@ -1302,15 +1302,15 @@

10 Context URL

The following subsections describe how the context URL is constructed for each category of payload by providing a context URL template. The context URL template uses the following terms:

-

Key values in the canonical path in {entity-set}, {single-entity}, and {entity} are represented in canonical form (parentheses-style) without percent-encoding.

+

Key values in the canonical path in {entity-collection}, {entity-singleton}, and {entity} are represented in canonical form (parentheses-style) without percent-encoding.

The full grammar for the context URL is defined in OData-ABNF. Note that the syntax of the context URL is independent of whatever URL conventions the service uses for addressing individual entities.

10.1 Service Document

@@ -1328,9 +1328,9 @@

10

10.2 Collection of Entities

Context URL template:

-
{context-url}#{entity-set}
+
{context-url}#{entity-collection}
 {context-url}#Collection({type-name})
-

If all entities in the collection are members of one (named or implicit) entity set, the context URL fragment is the canonical path {entity-set} to the entity set.

+

If all entities in the collection are members of one entity set (including implicit), the context URL fragment is the canonical path {entity-collection} to the entity set.

Example 11: resource URL and corresponding context URL

http://host/service/Customers
@@ -1341,52 +1341,51 @@ 

10.3 Entity

Context URL template:

-
{context-url}#{entity-set}/$entity
-{context-url}#{single-entity}
+
{context-url}#{entity-collection}/$entity
 {context-url}#{type-name}
-

If a response or response part is an entity of the declared type of a (named or implicit) entity set, the context URL fragment is the canonical path {entity-set} to the entity set with /$entity appended.

+

If a response or response part is an entity bound to an entity set (including implicit), the context URL fragment is the canonical path {entity-collection} to the entity set with /$entity appended.

Example 13: resource URL and corresponding context URL for named entity set. Note the absence of the key predicate (1) in the context URL.

http://host/service/Customers(1)
 http://host/service/$metadata#Customers/$entity
-

Example 14: resource URL and corresponding context URL for contained entity (implicit entity set)

+

Example 14: resource URL and corresponding context URL for contained entity

http://host/service/Orders(4711)/Items(1)
 http://host/service/$metadata#Orders(4711)/Items/$entity
-

If a response or response part is an entity of the declared type of a single-valued containment navigation property, the context URL fragment is the canonical path {single-entity} to that navigation property without /$entity appended.

-
-

Example 15: resource URL and corresponding context URL for entity targeted by a single-valued containment navigation property

-
http://host/service/Orders(4711)/DeliveryAddress
-http://host/service/$metadata#Orders(4711)/DeliveryAddress
-
-

If the entity is not bound to an entity set, such as an entity returned from a function or action with no entity set path, a function import or action import with no specified entity set, or a navigation property with no navigation property binding, the context URL fragment specifies the type {type-name} of the returned entity.

+

If the entity is within a collection, but its entity set (including implicit) cannot be determined, such as for an entity returned from a function or action with no entity set path, a function import or action import with no specified entity set, or a navigation property with no navigation property binding, the context URL fragment specifies the type {type-name} of the returned entity.

10.4 Singleton

Context URL template:

-
{context-url}#{single-entity}
+
{context-url}#{entity-singleton}

If a response or response part is a singleton, its name is the context URL fragment.

-

Example 16: resource URL and corresponding context URL

+

Example 15: resource URL and corresponding context URL

http://host/service/MainSupplier
 http://host/service/$metadata#MainSupplier
+

If a response or response part is an entity targeted by a single-valued containment navigation property, the context URL fragment is the canonical path {entity-singleton} to that navigation property without /$entity appended.

+
+

Example 16: resource URL and corresponding context URL for entity targeted by a single-valued containment navigation property

+
http://host/service/Orders(4711)/DeliveryAddress
+http://host/service/$metadata#Orders(4711)/DeliveryAddress
+

10.5 Collection of Derived Entities

Context URL template:

-
{context-url}#{entity-set}{/type-name}
-

If an entity set consists exclusively of derived entities, a type-cast segment is added to the context URL.

+
{context-url}#{entity-collection}{/type-name}
+

If a response or response part is a collection filtered by a type cast segment in the resource URL OData-URL, section 4.11, the type-cast segment is added to the context URL.

Example 17: resource URL and corresponding context URL

http://host/service/Customers/Model.VipCustomer
@@ -1397,28 +1396,34 @@ 

10.6 Derived Entity

Context URL template:

-
{context-url}#{entity-set}{/type-name}/$entity
-

If a response or response part is an entity of a type derived from the declared type of an entity set, a type-cast segment is appended to the entity set name.

+
{context-url}#{entity-collection}{/type-name}/$entity
+{context-url}#{entity-singleton}{/type-name}
+

If a response or response part is an entity filtered by a type cast segment in the resource URL OData-URL, section 4.11, the type-cast segment is appended to the {entity-collection} or {entity-singleton} and prior to appending /$entity, if any.

-

Example 18: resource URL and corresponding context URL

+

Example 18: resource URL with key predicate and corresponding context URL

http://host/service/Customers(2)/Model.VipCustomer
 http://host/service/$metadata#Customers/Model.VipCustomer/$entity
+
+

Example 19: resource URL for singleton and corresponding context URL

+
http://host/service/MainSupplier/Model.PreferredVendor
+http://host/service/$metadata#MainSupplier/Model.PreferredVendor
+

10.7 Collection of Projected Entities

Context URL templates:

-
{context-url}#{entity-set}{/type-name}{select-list}
+
{context-url}#{entity-collection}{/type-name}{select-list}
 {context-url}#Collection({type-name}){select-list}
-

If a result contains only a subset of properties, the parenthesized comma-separated list of the selected defined or dynamic properties, instance annotations, navigation properties, functions, and actions is appended to the context URL representing the collection of entities.

+

If a response or response part contains only a subset of properties, the parenthesized comma-separated list of the selected defined or dynamic properties, instance annotations, navigation properties, functions, and actions is appended to the context URL representing the collection of entities.

Regardless of how contained structural properties are represented in the request URL (as paths or as select options) they are represented in the context URL using path syntax, as defined in OData 4.0.

The shortcut * represents the list of all structural properties. Properties defined on types derived from the declared type of the entity set (or type specified in the type-cast segment if specified) are prefixed with the qualified name of the derived type as defined in OData-ABNF.

The list also contains explicitly selected or expanded instance annotations. It is possible to select or expand only instance annotations, in which case only those selected or expanded annotations appear in the result. Note that annotations specified only in the include-annotations preference do not appear in the context URL and do not affect the selected/expanded properties.

Operations in the context URL are represented using the namespace- or alias-qualified name. Function names suffixed with parentheses represent a specific overload, while function names without parentheses represent all overloads of the function.

OData 4.01 responses MAY use the shortcut pattern {namespace}.* to represent the list of all bound actions or functions available for entities in the collection, see system query option $select.

-

Example 19: resource URL and corresponding context URL

+

Example 20: resource URL and corresponding context URL

http://host/service/Customers?$select=Address,Orders,Model.VipCustomer/PreferredContact
 http://host/service/$metadata#Customers(Address,Orders,Model.VipCustomer/PreferredContact)
@@ -1427,17 +1432,17 @@

10.8 Projected Entity

Context URL templates:

-
{context-url}#{entity-set}{/type-name}{select-list}/$entity
-{context-url}#{single-entity}{select-list}
+
{context-url}#{entity-collection}{/type-name}{select-list}/$entity
+{context-url}#{entity-singleton}{/type-name}{select-list}
 {context-url}#{type-name}{select-list}
-

If an entity contains a subset of properties, the parenthesized comma-separated list of the selected defined or dynamic properties, instance annotations, navigation properties, functions, and actions is appended to the {entity-set} after an optional type-cast segment and prior to appending /$entity, or to the {single-entity}. If the response is not a subset of a single entity set, the {select-list} is instead appended to the {type-name} of the returned entity.

+

If a response or response part is an entity that contains a subset of properties, the parenthesized comma-separated list of the selected defined or dynamic properties, instance annotations, navigation properties, functions, and actions is appended to the {entity-collection} or {entity-singleton} after an optional type-cast segment and prior to appending /$entity, if any.

Regardless of how contained structural properties are represented in the request URL (as paths or as select options) they are represented in the context URL using path syntax, as defined in OData 4.0.

The shortcut * represents the list of all structural properties. Properties defined on types derived from the type of the entity set (or type specified in the type-cast segment if specified) are prefixed with the qualified name of the derived type as defined in OData-ABNF. Note that expanded properties are automatically included in the response.

The list also contains explicitly selected or expanded instance annotations. It is possible to select or expand only instance annotations, in which case only those selected or expanded annotations appear in the result. Note that annotations specified only in the include-annotations preference do not appear in the context URL and do not affect the selected/expanded properties.

Operations in the context URL are represented using the namespace- or alias-qualified name. Function names suffixed with parentheses represent a specific overload, while function names without parentheses represent all overloads of the function.

OData 4.01 responses MAY use the shortcut pattern {namespace}.* to represent the list of all bound actions or functions available for the returned entity, see system query option $select.

-

Example 20: resource URL and corresponding context URL

+

Example 21: resource URL and corresponding context URL

http://host/service/Customers(1)?$select=Name,Rating
 http://host/service/$metadata#Customers(Name,Rating)/$entity
@@ -1446,7 +1451,7 @@

10

10.9 Collection of Expanded Entities

Context URL template:

-
{context-url}#{entity-set}{/type-name}{select-list}
+
{context-url}#{entity-collection}{/type-name}{select-list}
 {context-url}#Collection({type-name}){select-list}

For a 4.01 response, if a navigation property is explicitly expanded, then in addition to any non-suffixed names of any selected properties, navigation properties, functions or actions, the comma-separated list of properties MUST include the name of the expanded property, suffixed with the parenthesized comma-separated list of any properties of the expanded navigation property that are selected or expanded. If the expanded navigation property does not contain a nested $select or $expand, then the expanded property is suffixed with empty parentheses. If the expansion is recursive for nested children, a plus sign (+) is infixed between the navigation property name and the opening parenthesis.

For a 4.0 response, the expanded navigation property suffixed with parentheses is omitted from the select-list if it does not contain a nested $select or $expand, but MUST still be present, without a suffix, if it is explicitly selected.

@@ -1454,17 +1459,17 @@

-

Example 21: resource URL and corresponding context URL — select and expand

+

Example 22: resource URL and corresponding context URL — select and expand

http://host/service/Customers?$select=Name&$expand=Address/Country
 http://host/service/$metadata#Customers(Name,Address/Country())
-

Example 22: resource URL and corresponding context URL — expand $ref

+

Example 23: resource URL and corresponding context URL — expand $ref

http://host/service/Customers?$expand=Orders/$ref
 http://host/service/$metadata#Customers
-

Example 23: resource URL and corresponding context URL — expand with $levels

+

Example 24: resource URL and corresponding context URL — expand with $levels

http://host/service/Employees/Sales.Manager?$select=DirectReports
         &$expand=DirectReports($select=FirstName,LastName;$levels=4)
 http://host/service/$metadata
@@ -1475,15 +1480,15 @@ 

10.10 Expanded Entity

Context URL template:

-
{context-url}#{entity-set}{/type-name}{select-list}/$entity
-{context-url}#{single-entity}{select-list}
+
{context-url}#{entity-collection}{/type-name}{select-list}/$entity
+{context-url}#{entity-singleton}{/type-name}{select-list}
 {context-url}#{type-name}{select-list}

For a 4.01 response, if a navigation property is explicitly expanded, then in addition to the non-suffixed names of any selected properties, navigation properties, functions or actions, the comma-separated list of properties MUST include the name of the expanded property, suffixed with the parenthesized comma-separated list of any properties of the expanded navigation property that are selected or expanded. If the expanded navigation property does not contain a nested $select or $expand, then the expanded property is suffixed with empty parentheses. If the expansion is recursive for nested children, a plus sign (+) is infixed between the navigation property name and the opening parenthesis.

For a 4.0 response, the expanded navigation property suffixed with parentheses is omitted from the select-list if it does not contain a nested $select or $expand, but MUST still be present, without a suffix, if it is explicitly selected.

If the context URL includes only expanded navigation properties (i.e., only navigation properties suffixed with parentheses), then all structural properties are implicitly selected (same as if there were no properties listed in the select-list).

Navigation properties with expanded references are not represented in the context URL.

-

Example 24: resource URL and corresponding context URL

+

Example 25: resource URL and corresponding context URL

http://host/service/Employees(1)/Sales.Manager?
         $expand=DirectReports($select=FirstName,LastName;$levels=4)
 http://host/service/$metadata
@@ -1497,7 +1502,7 @@ 

-

Example 25: resource URL and corresponding context URL for a collection of entity references

+

Example 26: resource URL and corresponding context URL for a collection of entity references

http://host/service/Customers('ALFKI')/Orders/$ref
 http://host/service/$metadata#Collection($ref)

@@ -1509,7 +1514,7 @@

1
{context-url}#$ref

If a response is one entity reference, $ref is the context URL fragment.

-

Example 26: resource URL and corresponding context URL for a single entity reference

+

Example 27: resource URL and corresponding context URL for a single entity reference

http://host/service/Orders(10643)/Customer/$ref
 http://host/service/$metadata#$ref
@@ -1523,7 +1528,7 @@

10.13 P

If a response represents an individual property of an entity with a canonical URL, the context URL specifies the canonical URL of the entity and the path to the structural property of that entity. The path MUST include cast segments for properties defined on types derived from the expected type of the previous segment.

If the property value does not contain explicitly or implicitly selected navigation properties or operations, OData 4.01 responses MAY use the less specific second template.

-

Example 27: resource URL and corresponding context URL

+

Example 28: resource URL and corresponding context URL

http://host/service/Customers(1)/Addresses
 http://host/service/$metadata#Customers(1)/Addresses
@@ -1535,7 +1540,7 @@

-

Example 28: resource URL and corresponding context URL

+

Example 29: resource URL and corresponding context URL

http://host/service/TopFiveHobbies()
 http://host/service/$metadata#Collection(Edm.String)

@@ -1547,7 +1552,7 @@

-

Example 29: resource URL and corresponding context URL

+

Example 30: resource URL and corresponding context URL

http://host/service/MostPopularName()
 http://host/service/$metadata#Edm.String
@@ -1556,14 +1561,14 @@

10.16 Operation Result

Context URL templates:

-
{context-url}#{entity-set}{/type-name}{select-list}
-{context-url}#{entity-set}{/type-name}{select-list}/$entity
+
{context-url}#{entity-collection}{/type-name}{select-list}
+{context-url}#{entity-collection}{/type-name}{select-list}/$entity
 {context-url}#{entity}/{property-path}{select-list}
 {context-url}#Collection({type-name}){select-list}
 {context-url}#{type-name}{select-list}

If the response from an action or function is a collection of entities or one entity that is a member of an entity set, the context URL identifies the entity set. If the response from an action or function is a property of one entity, the context URL identifies the entity and property. Otherwise, the context URL identifies the type returned by the operation. The context URL will correspond to one of the former examples.

-

Example 30: resource URL and corresponding context URL

+

Example 31: resource URL and corresponding context URL

http://host/service/TopFiveCustomers()
 http://host/service/$metadata#Customers
@@ -1572,14 +1577,14 @@

1

10.17 Delta Payload

Context URL template:

-
{context-url}#{entity-set}{/type-name}{select-list}/$delta
+
{context-url}#{entity-collection}{/type-name}{select-list}/$delta
 {context-url}#{entity}{select-list}/$delta
 {context-url}#{entity}/{property-path}{select-list}/$delta
 #$delta

The context URL of a delta response is the context URL of the response to the defining query, followed by /$delta. This includes singletons, single-valued navigation properties, and collection-valued navigation properties.

-

If the entities are contained, then {entity-set} is the top-level entity set followed by the path to the containment navigation property of the containing entity.

+

If the entities are contained, then {entity-collection} is the top-level entity set followed by the path to the containment navigation property of the containing entity.

-

Example 31: resource URL and corresponding context URL

+

Example 32: resource URL and corresponding context URL

http://host/service/Customers?$deltatoken=1234
 http://host/service/$metadata#Customers/$delta
@@ -1589,10 +1594,10 @@

10.17 Delt

10.18 Item in a Delta Payload

Context URL templates:

-
{context-url}#{entity-set}/$deletedEntity
-{context-url}#{entity-set}/$link
-{context-url}#{entity-set}/$deletedLink
-

In addition to new or changed entities which have the canonical context URL for an entity, a delta response can contain deleted entities, new links, and deleted links. They are identified by the corresponding context URL fragment. {entity-set} corresponds to the set of the deleted entity, or source entity for an added or deleted link.

+
{context-url}#{entity-collection}/$deletedEntity
+{context-url}#{entity-collection}/$link
+{context-url}#{entity-collection}/$deletedLink
+

In addition to new or changed entities which have the canonical context URL for an entity, a delta response can contain deleted entities, new links, and deleted links. They are identified by the corresponding context URL fragment. {entity-collection} corresponds to the set of the deleted entity, or source entity for an added or deleted link.

10.19 $all Response

@@ -1734,7 +1739,7 @@

204 No Content.

If the property is not available, for example due to permissions, the service responds with 404 Not Found.

-

Example 32:

+

Example 33:

GET http://host/service/Products(1)/Name
@@ -1755,7 +1760,7 @@

204 No Content response.

If the property or operation result is not available, for example due to permissions, the service responds with 404 Not Found.

-

Example 33:

+

Example 34:

GET http://host/service/Products(1)/Name/$value

@@ -1770,27 +1775,27 @@

actions and functions explicitly requested by the client. The service returns the specified content, if available, along with any available expanded navigation or stream properties, and MAY return additional information.

The value of the $select query option is a comma-separated list of paths that end with properties, non-entity-valued instance annotations, qualified action names, or qualified function names, as well as of the star operator (*), or the star operator prefixed with the namespace or alias of the schema in order to specify all operations defined in the schema. Only aliases defined in the metadata document of the service can be used in URLs.

-

Example 34: request only the Rating and ReleaseDate for the matching Products

+

Example 35: request only the Rating and ReleaseDate for the matching Products

GET http://host/service/Products?$select=Rating,ReleaseDate

It is also possible to request all structural properties, including any dynamic properties, using the star operator. The star operator SHOULD NOT introduce navigation properties, actions or functions not otherwise requested.

-

Example 35:

+

Example 36:

GET http://host/service/Products?$select=*

Properties of related entities can be specified by including the $select query option within the $expand.

-

Example 36:

+

Example 37:

GET http://host/service/Products?$expand=Category($select=Name)

The properties specified in $select are represented in addition to any expanded navigation or stream properties. If a navigation property is specified in $select, then the corresponding navigation link is represented in the response. If the navigation property also appears in an $expand query option, then it is additionally represented as inline content.

-

Example 37: for each category, return the CategoryName and the Products navigation link

+

Example 38: for each category, return the CategoryName and the Products navigation link

GET http://host/service/Categories?$select=CategoryName,Products

It is also possible to request all actions or functions available for each returned entity.

-

Example 38:

+

Example 39:

GET http://host/service/Products?$select=DemoService.*

Query options can be applied to a selected property by appending a semicolon-separated list of query options, enclosed in parentheses, to the property. Allowed system query options are $select and $compute for complex properties, plus $filter, $search, $count, $orderby, $skip, and $top for collection-valued properties. A property MUST NOT have select options specified in more than one place in a request and MUST NOT have both select options and expand options specified.

@@ -1804,15 +1809,15 @@

OData-URL, section 5.1.3.

-

Example 39: for each customer entity within the Customers entity set the value of all related Orders will be represented inline

+

Example 40: for each customer entity within the Customers entity set the value of all related Orders will be represented inline

GET http://host/service.svc/Customers?$expand=Orders
-

Example 40: for each customer entity within the Customers entity set the references to the related Orders will be represented inline

+

Example 41: for each customer entity within the Customers entity set the references to the related Orders will be represented inline

GET http://host/service.svc/Customers?$expand=Orders/$ref
-

Example 41: for each customer entity within the Customers entity set the media stream representing the customer photo will be represented inline

+

Example 42: for each customer entity within the Customers entity set the media stream representing the customer photo will be represented inline

GET http://host/service.svc/Customers?$expand=Photo
@@ -1821,11 +1826,11 @@
11.2.

The set of expanded entities can be further refined through the application of expand options, expressed as a semicolon-separated list of system query options, enclosed in parentheses, see OData-URL.

Allowed system query options are $compute, $select, $expand, and $levels for all navigation properties, plus $filter, $orderby, $skip, $top, $count, and $search for collection-valued navigation properties.

-

Example 42: for each customer entity within the Customers entity set, the value of those related Orders whose Amount is greater than 100 will be represented inline

+

Example 43: for each customer entity within the Customers entity set, the value of those related Orders whose Amount is greater than 100 will be represented inline

GET http://host/service.svc/Customers?$expand=Orders($filter=Amount gt 100)
-

Example 43: for each order within the Orders entity set, the following will be represented inline:

+

Example 44: for each order within the Orders entity set, the following will be represented inline:

-

Example 44: for each customer entity in the Customers entity set, the value of all related InHouseStaff will be represented inline if the entity is of type VipCustomer or a subtype of that. For entities that are not of type VipCustomer, or any of its subtypes, that entity may be returned with no inline representation for the expanded navigation property InHouseStaff (the service can always send more than requested)

+

Example 45: for each customer entity in the Customers entity set, the value of all related InHouseStaff will be represented inline if the entity is of type VipCustomer or a subtype of that. For entities that are not of type VipCustomer, or any of its subtypes, that entity may be returned with no inline representation for the expanded navigation property InHouseStaff (the service can always send more than requested)

GET http://host/service.svc/Customers?$expand=SampleModel.VipCustomer/InHouseStaff
@@ -1844,7 +1849,7 @@
-

Example 45: return each employee from the Employees entity set and, for each employee that is a manager, return all direct reports, recursively to four levels

+

Example 46: return each employee from the Employees entity set and, for each employee that is a manager, return all direct reports, recursively to four levels

GET http://host/service/Employees?$expand=Model.Manager/DirectReports($levels=4)
@@ -1856,7 +1861,7 @@

The $compute system query option allows clients to define computed properties that can be used in a $select or within a $filter or $orderby expression.

Computed properties SHOULD be included as dynamic properties in the result and MUST be included if $select is specified with the computed property name, or star (*).

-

Example 46: compute total price for order items (line breaks only for readability)

+

Example 47: compute total price for order items (line breaks only for readability)

GET http://host/service/Customers
    ?$filter=Orders/any(o:o/TotalPrice gt 100)
    &$expand=Orders($compute=Price mult Qty as TotalPrice
@@ -1876,12 +1881,12 @@ 

-

Example 47: return all Products whose Price is less than $10.00

+

Example 48: return all Products whose Price is less than $10.00

GET http://host/service/Products?$filter=Price lt 10.00

The $count segment may be used within a $filter expression to limit the items returned based on the exact count of related entities or items within a collection-valued property.

-

Example 48: return all Categories with less than 10 products

+

Example 49: return all Categories with less than 10 products

GET http://host/service/Categories?$filter=Products/$count lt 10

The value of the $filter option is a Boolean expression as defined in OData-ABNF.

@@ -1981,7 +1986,7 @@
function parameters, or within a $compute, $filter or $orderby expression. Parameters aliases are names beginning with an at sign (@).

Actual parameter values are specified as query options in the query part of the request URL. The query option name is the name of the parameter alias, and the query option value is the value to be used for the specified parameter alias.

-

Example 49: returns all employees whose Region property matches the string parameter value WA

+

Example 50: returns all employees whose Region property matches the string parameter value WA

GET http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'

Parameter aliases allow the same value to be used multiple times in a request and may be used to reference primitive, structured, or collection values.

@@ -1989,7 +1994,7 @@
-

Example 50: returns all employees, expands their manager, and expands all direct reports with the same first name as the manager, using a parameter alias for $this to pass the manager into the filter on the expanded direct reports

+

Example 51: returns all employees, expands their manager, and expands all direct reports with the same first name as the manager, using a parameter alias for $this to pass the manager into the filter on the expanded direct reports

GET http://host/service.svc/Employees?$expand=Manager(@m=$this;$expand=DirectReports($filter=@m/FirstName eq FirstName))

@@ -2006,17 +2011,17 @@

Services SHOULD order language-dependent strings according to the Content-Language of the response, and SHOULD annotate string properties with language-dependent order with the term Core.IsLanguageDependent, see OData-VocCore.

Values of type Edm.Stream or any of the Geo types cannot be sorted.

-

Example 51: return all Products ordered by release date in ascending order, then by rating in descending order

+

Example 52: return all Products ordered by release date in ascending order, then by rating in descending order

GET http://host/service/Products?$orderby=ReleaseDate asc, Rating desc

Related entities may be ordered by specifying $orderby within the $expand clause.

-

Example 52: return all Categories, and their Products ordered according to release date and in descending order of rating

+

Example 53: return all Categories, and their Products ordered according to release date and in descending order of rating

GET http://host/service/Categories?$expand=Products($orderby=ReleaseDate asc, Rating desc)

$count may be used within a $orderby expression to order the returned items according to the exact count of related entities or items within a collection-valued property.

-

Example 53: return all Categories ordered by the number of Products within each category

+

Example 54: return all Categories ordered by the number of Products within each category

GET http://host/service/Categories?$orderby=Products/$count

@@ -2027,7 +2032,7 @@

\(A\) be a copy of the result set with a total order that extends any existing order of the result set but is otherwise chosen by the service. If no unique ordering is imposed through an $orderby query option, the service MUST choose a stable ordering across requests that include $top or $skip.

If \(A\) contains more than \(n\) instances, the result of \({\tt \$top}=n\) consists of the first \(n\) instances in \(A\). Otherwise, the result equals \(A\). The instances in the result are in the same order as they occur in \(A\).

-

Example 54: return only the first five products of the Products entity set

+

Example 55: return only the first five products of the Products entity set

GET http://host/service/Products?$top=5
@@ -2038,12 +2043,12 @@

\(A\) be a copy of the result set with a total order that extends any existing order of the result set but is otherwise chosen by the service. If no unique ordering is imposed through an $orderby query option, the service MUST choose a stable ordering across requests that include $top or $skip.

If \(A\) contains \(n\) or fewer instances, the result of \({\tt \$skip}=n\) is empty. Otherwise, the first \(n\) instances in \(A\) are omitted from the result and all remaining instances are kept in the same order as they occur in \(A\).

-

Example 55: return products starting with the 6th product of the Products entity set

+

Example 56: return products starting with the 6th product of the Products entity set

GET http://host/service/Products?$skip=5

Where $top and $skip are used together, $skip MUST be applied before $top, regardless of the order in which they appear in the request.

-

Example 56: return the third through seventh products of the Products entity set

+

Example 57: return the third through seventh products of the Products entity set

GET http://host/service/Products?$top=5&$skip=2

If no unique ordering is imposed through an $orderby query option, the service MUST impose a stable ordering across requests that include $skip.

@@ -2053,12 +2058,12 @@

-

Example 57: return, along with the results, the total number of products in the collection

+

Example 58: return, along with the results, the total number of products in the collection

GET http://host/service/Products?$count=true

The count of related entities can be requested by specifying the $count query option within the $expand clause.

-

Example 58:

+

Example 59:

GET http://host/service/Categories?$expand=Products($count=true)

A $count query option with a value of false (or not specified) hints that the service SHOULD NOT return a count.

@@ -2071,32 +2076,32 @@