Query Dynamics 365 records using the Web API with OData filter expressions

domain: learn.microsoft.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Obtain a bearer token from Azure AD using the OAuth 2.0 client credentials or auth code flow with the Dynamics 365 resource URI as the scope
  2. Construct a GET request to https://{org}.crm.dynamics.com/api/data/vX.X/{entitySetName} with OData query parameters: $select for fields, $filter for conditions, $orderby, and $top for page size
  3. Add the Prefer: odata.maxpagesize={n} request header to control server-side paging; the response will include an @odata.nextLink value when more records exist
  4. Fetch subsequent pages by issuing a GET to the @odata.nextLink URL exactly as returned — do not modify it
  5. Use $expand to include related entity data in the same response (e.g., $expand=primarycontactid($select=fullname))

Known gotchas

Related routes

Send multiple Dynamics 365 Web API operations in a single OData batch request
learn.microsoft.com · 5 steps · unrated
Use the Dynamics 365 Dataverse FetchXML API via the Web API to run aggregate and linked-entity queries
learn.microsoft.com/dynamics365 · 6 steps · unrated
Query and update BOM line data entities in Dynamics 365 Finance and Operations using the OData API (BOMLineEntity / BOMHeaderV2Entity)
learn.microsoft.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans