2.19OData API Requests

Updated on Aug 18, 2026~1 min read

OData (Open Data Protocol) is a REST-based Web protocol that lets you query an API through URL parameters just like operating on a database: filtering, sorting, paging, selecting fields, and so on. For example:

  • $filter=Country eq 'China' filters
  • $select=CustomerID,CompanyName specifies the fields
  • $top=10 takes only the first 10 records

Many Microsoft services (Dynamics 365, Microsoft Graph) support OData. The framework supports requests to OData APIs; the following is sample code:

cs
var result = await httpRemoteService.GetAsStringAsync("https://your-host-address/odata/Customers",    builder => builder.WithQueryParameters(new Dicitionary<string, object>    {        {"$top", "2"},        {"$select", "CustomerID,CompanyName"},        {"$format", "json"}    }));// Parse the JSON content (a dynamic object such as `Clay` is recommended)var node = JsonNode.Parse(result!);var customers = node.Deserialize<List<Customer>>();