Manipulate Data in the Cloud: ADO.NET Data Services Framework URI Query Options: Table 1: Apply Query Options to Shape and Page the Content Returned.

URI queries more complex than those to return a single Atom <entry>, property, or collection of <entry>s require use of one or more of the six query option reserved words: $expand, $filter, $orderby, $skip, $top, and $value. Use an ampersand (&) to separate multiple option expressions. The .../ abbreviation represents the service prefix, such as http://localhost:52660/Northwind.svc. Entity, EntitySet, and property names are case-sensitive. Italic text in the table is part of the URI query. The $metadata option, which returns the full set of metadata from the conceptual layer (*.CSDL file), isn't included in the table because it doesn't affect shaping or paging content. Browsers URL-encode spaces in URI queries as %20.

Option Description Example
$expand Returns nested related entities with the target entity .../Customers('RATTC')?$expand=Orders returns a <feed> document with Customer data and <entry>s for all Orders placed by the Customer.

.../Customers('RATTC')?$expand=Orders(10262)/Employee returns a <feed> document with header data and Order_Details <entry>s for Order 10262.

.../Orders(10262)?$expand=Shipper,Employee returns an <entry> fragment with Orders, Shipper, and Employee content.
$filter Restricts the content returned by the operator expression (see Table 2) .../Orders?$filter=ShipCountry eq 'USA' returns all Orders shipped to the United States.

.../Orders?$filter=ShipCity eq 'USA' and OrderDate gt '1996-12-31' returns all Orders shipped to the United States after Dec. 31, 1996 (see Table 2).
$orderby Sorts the content by the specific property value ascending (asc, default) or descending (desc) .../Orders?$orderby=ShipCountry sorts alphabetically by destination country.

.../Orders?$orderby=ShipCountry desc reverses the sort order.

.../Orders?$orderby=ShipCountry desc,ShipCity adds destination city to the sort.
$skip Skips the number of instances specified by the skip parameter .../Orders?$skip=10 returns all Orders after the first 10.
$top Supplies the number of instances specified by the top parameter .../Orders?$skip=10&$top=10 returns 10 Orders after the first 10.

.../Orders?$skip=90&$top=10 returns the tenth page with 10 Orders per page.
$value Returns the scalar value of a property or resource .../Categories(1)/Description/$value gives you the string value of Description for a given category, not an ATOM entry.
comments powered by Disqus

Featured

  • Mastering AI Development and Building AI Apps with GitHub Copilot

    Two Microsoft experts explain how GitHub Copilot is evolving from a coding assistant into a broader platform for building, customizing and testing AI-powered developer workflows.

  • VS Code 1.123 Adds Agent Session Sync, 1M Context Windows

    Microsoft released Visual Studio Code 1.123 on June 3, adding agent-focused features, larger model context support, integrated browser updates and a new delay for some automatic extension updates.

  • Copilot Billing Shock Hits Developers

    Developer complaints about GitHub Copilot's new usage-based billing model have centered on unexpectedly rapid AI credit consumption, and neither GitHub nor Microsoft has responded directly to the backlash, though they have previously published guidance to lessen model usage costs.

  • Hands On with GitHub Copilot App Technical Preview: Turning a Blazor Issue into a PR

    GitHub's brand-new Copilot desktop app, in technical preview, handled a small Blazor issue from planning through pull request creation, but the hands-on test also showed why developers still need to verify agent work in the running app before merging.

Subscribe on YouTube