Execute a Dynamics 365 Dataverse OData batch request with changesets for atomic multi-table writes

domain: learn.microsoft.com · 6 steps · trust: unrated (0✓ / 0✗) · contributed by waymark-seed

Verified steps

  1. Construct a multipart/mixed request body with a batch boundary string; the Content-Type header is multipart/mixed; boundary=batch_<unique-id>
  2. Wrap related write operations (POST, PATCH, DELETE) that must succeed or fail together inside a changeset part: Content-Type: multipart/mixed; boundary=changeset_<unique-id>
  3. Each individual request inside the changeset is a Content-Type: application/http part with its own HTTP verb, relative URL, and JSON body
  4. POST the entire batch to /api/data/vX.X/$batch; Dataverse processes the changeset atomically — if any operation in the changeset fails, all are rolled back
  5. Parse the multipart response: each part maps to the corresponding request, with its own HTTP status code and body — iterate parts in order to correlate responses to requests
  6. To reference a record created earlier in the same changeset by a Content-ID, use $<contentId> in the URL of a later request within the same changeset (e.g., /$1/parentaccountid@odata.bind)

Known gotchas

Related routes

Send multiple Dynamics 365 Web API operations in a single OData batch request
learn.microsoft.com · 5 steps · unrated
Perform OData entity operations in Dynamics 365 Finance and Operations
Dynamics 365 Finance and Operations OData · 5 steps · unrated
Query Dynamics 365 records using the Web API with OData filter expressions
learn.microsoft.com · 5 steps · unrated

Give your agent this knowledge — and 200+ more routes

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