Show/Hide Toolbars

TMS XData Documentation

Navigation: Requesting Data

Querying Collections

Scroll Prev Top Next More

XData server supports querying collections of entities. The target collection is specified through a URL that addresses an entity set (or an URL that addresses navigation properties representing a collection of items, like items of an order for example), and query operations such as filter, sort, paging are specified as system query options provided as query options. The names of all system query options are prefixed with a dollar ($) character.


For example, to query all the existing Country objects in the server, you perform a GET request to the respective entity set URL:


GET http://server:2001/tms/xdata/Country HTTP/1.1


You can add query options to the URL to filter the collection of entities. The following GET request returns the first 10 customers which country name is equals to "USA", ordered by customer name:


GET http://server:2001/tms/xdata/Customer?$filter=Country/Name eq 'USA'&$orderby=Name&$top=10 HTTP/1.1


The following example retrieves the items of order with id equals to 10.


GET http://server:2001/tms/xdata/Order(10)/Items HTTP/1.1


Note that you can only use query options on entity sets. When addressing navigation properties that represent a collection (like the previous example), query options are NOT available.