Skip to content

Offer the whole Dataverse Web API: OData's conventions, its headers, batches and search - #436

Merged
tnkuehne merged 2 commits into
mainfrom
dataverse-api-coverage
Nov 26, 2026
Merged

tnkuehne merged 2 commits into
mainfrom
dataverse-api-coverage

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The Dataverse template now covers the Web API as Microsoft documents it. Every request kind and header the docs describe is a method or an input, so an agent that builds an app from the Web API documentation finds each documented request where it expects it. The app's users still act with their own accounts, and Dataverse's security roles decide what each request may do.

Generator

The generator derives OData's addresses for any CSDL service:

  • the service document
  • $count for a table and for related rows
  • one column, with $value for its content
  • type casts as an optional segment
  • related rows by key, which can be read, changed, replaced and deleted
  • $ref: read, set and delete
  • PUT on rows, which Dataverse requires for table and column definitions
  • actions and functions the CSDL does not describe, unbound or bound to a table or row, with parameter aliases

The shared REST runtime, synced to every REST template:

  • leaves out an optional segment that has no value, and pages work with or without it
  • sends an exploded map as separate query parameters
  • sends a file body (format: binary) as bytes with its media type
  • rejects empty path values, which would leave out a segment

Dataverse template

  • Headers and query options on every method, taken from the Web API documentation:
    • Every method: CallerObjectId and MSCRMCallerID.
    • Changes: the MSCRM.Bypass* headers and tag.
    • Reads: Consistency and MSCRM.SessionToken.
    • Where they apply: MSCRM.SolutionUniqueName, MSCRM.MergeLabels, MSCRM.SuppressDuplicateDetection, savedQuery, userQuery, UnMaskedData, partitionId, Range, size, and the chunked-upload headers.
  • Answer headers in results. A result carries the answer headers that hold data: a created row's OData-EntityId, the Location and x-ms-chunk-size of a chunked upload, x-ms-session-token, ETag, and a file's name and size.
  • not_modified. getRow with ifNoneMatch returns not_modified when the row is unchanged.
  • batch runs $batch.
    • It takes requests and change sets and numbers the Content-IDs a change set needs.
    • It asks once, for the strongest change among its requests: an action counts as its own method's change, and an unknown action counts as an update.
    • It rejects line breaks in addresses and headers, addresses outside the service, an Authorization header, and $n references to rows no request creates.
  • Approval classes follow what a request changes.
    • A new row whose body binds existing rows, such as [email protected], changes them and asks like an update.
    • The functions that write ask first: CalculateRollupField, IncrementKnowledgeArticleViewCount, ResetInheritedAccess and RemoveActiveCustomizations.
    • CloneAsPatch counts as an update, because a patch locks its parent solution.
    • callAction, callFunction and the bound variants, and every request of a batch (including one on a Content-ID's row), use the change of the known operation they reach.
  • Batch answers keep their content. Each part is parsed as bytes and returned according to its media type.
  • Search endpoint. The searchV2* methods call Dataverse search at /api/search/v2.0.

Tests

  • pnpm lint, pnpm typecheck and pnpm format:check pass.
  • The tests of the generator and of all 9 REST templates pass.
  • The real worker ran against a Dataverse sandbox. These Dataverse answers were checked live:
    • $batch with a change set
    • $count
    • Search 2.0
    • an unbound and a bound function
    • the service document
    • type-cast and nested-key addresses
  • That run found and fixed two bugs: a missing Content-ID in change sets, and empty IDs. A second run checked the byte-level batch parsing.
  • Not yet run live: writing rows and changing table definitions. The sandbox user's role does not allow either, and these runs are still pending.

…batches and search

The generator now derives every OData address of a CSDL service: the service
document, `$count`, one column and its content, casts to derived types,
related rows by key, `$ref` reads and writes, replacing a row with PUT, and
actions and functions the CSDL does not describe, bound or unbound, with
parameter aliases. Its REST runtime leaves out optional segments, sends
exploded maps as query parameters, uploads file bodies as bytes and rejects
empty path values.

The Dataverse template takes the Web API's headers and query options on every
method, returns the answer headers that carry results, such as a created row's
OData-EntityId, answers not_modified, runs $batch with change sets under one
approval, and offers the search endpoint /api/search/v2.0.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 0306ef8 Nov 26 2026, 09:23 PM

…s hide

A new row whose body binds existing rows, such as [email protected],
changes them, so it asks like an update. Functions that write,
CalculateRollupField, IncrementKnowledgeArticleViewCount,
ResetInheritedAccess and RemoveActiveCustomizations, ask too, and so does
CloneAsPatch, which locks its parent solution. Calls by name and requests of a
batch, including those on a Content-ID's row, take the change of the known
operation they reach.

Batch answers are parsed as bytes and returned as their media type says. Only
map inputs send their fields as query parameters. Row queries take parameter
aliases and LabelLanguages, creating a row takes $expand, lists type their
delta link, uploads take x-ms-file-name as a header, and downloads return the
mimetype header.
@tnkuehne
tnkuehne merged commit 00259d3 into main Nov 26, 2026
5 checks passed
@tnkuehne
tnkuehne deleted the dataverse-api-coverage branch November 26, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant