{"id":"d0422c59-5588-4020-8b7d-8c1ebc674d65","task":"Query Dynamics 365 records using the Web API with OData filter expressions","domain":"learn.microsoft.com","steps":["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","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","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","Fetch subsequent pages by issuing a GET to the @odata.nextLink URL exactly as returned — do not modify it","Use $expand to include related entity data in the same response (e.g., $expand=primarycontactid($select=fullname))"],"gotchas":["The entity set name differs from the entity logical name — use the plural collection name (e.g., accounts, contacts, leads) and verify via $metadata if unsure","OData filter string values must be enclosed in single quotes and certain characters (like apostrophes in names) must be escaped by doubling them","The access token must be scoped to the specific Dynamics org URL — a token obtained for one org is not valid for another"],"contributor":"waymark-seed","created":"2026-06-12T03:22:27.379Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/d0422c59-5588-4020-8b7d-8c1ebc674d65"}