For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Reference

Everything the Web-API user interface does is available as an HTTP API on the same address. This page covers the tools API, which lets a script or an AI agent test transformations without the browser.

Calling the API

The API uses the Connect protocol, which also accepts plain JSON over HTTP:

  • Send a POST request to /<service>/<method>.

  • Set Content-Type: application/json.

  • Put the request message in the body as JSON. Field names are in camelCase.

The same endpoints also accept gRPC and gRPC-Web, and gRPC reflection is enabled.

Tools Service

Service name: adiom.tools.v1.ToolsService. It is the API behind Transform Studio and the Sync Tester.

Method
Purpose
Touches databases

Run a transform config against sample documents.

No

Pick random document IDs from a source.

Reads the source

Fetch documents by ID, optionally transformed.

Reads one connector

Copy documents by ID from source to destination.

Reads the source, writes the destination

Compare documents by ID between source and destination.

Reads both

Common conventions:

  • Connectors and transformers are given as lists of command-line arguments, exactly as on the dsynct command line. For example ["mongodb://localhost:27017"], or ["grpc://cosmosnosqlconnector:8089", "--insecure"].

  • A transformer is ["dsync-transform://transform.yaml"] for a file on the web-api host, ["dsync-transform://", "--yaml", "<config>"] to send the config inline, or ["grpc://host:port", "--insecure"] for a transformer running as a separate process.

  • Data types are DATA_TYPE_MONGO_BSON or DATA_TYPE_JSON_ID. A data type that is left out (or DATA_TYPE_UNKNOWN) is inferred from the connector or the transformer. Only Transform requires both types.

  • IDs are extended JSON objects in a string, one per document: "{\"_id\": {\"$oid\": \"...\"}}". For a multi-part ID, list the parts in order: "{\"region\": \"us-east\", \"id\": \"123\"}".

  • BSON documents are sent and returned as canonical extended JSON in a string. JSON documents are plain JSON in a string.

Transform

Runs one or more sample documents through a transform config and returns the result for each kind of event. Nothing is read from or written to a database.

Request field
Type
Description

transformArgs

list of strings

The transformer. Required.

namespace

string

The namespace passed to the transformer. If it matches no namespace in the config and there is no defaultmapping, documents pass through unchanged when srcType and dstType are equal, and the mode returns an error when they differ.

srcType

data type

Type of the input documents. Required.

dstType

data type

Type of the output documents. Required.

payloads

list of strings

Sample documents.

ids

list of strings

The ID of each document, in the same order as payloads. When both are given they must have the same length.

partialUnset

list of strings

Field names to remove. When set, only the partial update is run.

Which modes run depends on what you send:

You send
Modes returned

payloads only

MODE_DATA (initial sync)

ids only

MODE_DELETE

payloads and ids

MODE_DATA, MODE_INSERT, MODE_UPDATE, MODE_PARTIAL_UPDATE, MODE_DELETE

ids and partialUnset, with or without payloads

MODE_PARTIAL_UPDATE only

The response has one entry in results per mode:

Response field
Description

results[].mode

The mode.

results[].error

The transform error for this mode, if any. The HTTP request itself still succeeds.

results[].entries[].namespace

The destination namespace.

results[].entries[].data

For MODE_DATA: the transformed documents.

results[].entries[].updates

For the other modes: the transformed events, each with id, data, type and partialUpdateUnset.

A request with an invalid config or an unreadable payload fails with HTTP 400 and a message such as invalid transformer config: ....

Example:

Response, shortened to two of the five modes:

When a document fails, the mode carries the error instead of entries:

See Troubleshooting Transforms for what the messages mean.

SampleIds

Picks random document IDs from a source namespace. Equivalent to the sample-ids command.

Request field
Description

args

The source connector, followed by the transformer arguments when transform is true.

namespace

The source namespace.

count

Number of IDs to return. Default 100.

maxIterPerPartition

Limits how much of each partition is read. Without it, the whole namespace is scanned.

idKeys

Names of the ID fields, if they differ from the default.

transform

Set to true, with the transformer arguments appended to args, to get the IDs as they look after the transform.

srcDataType, dstDataType

Optional. Inferred if not set.

The response contains ids and totalSeen.

FetchDocs

Fetches documents by ID from one connector. With transform set, the documents are returned after the transform. Use it to collect sample documents exactly as the source emits them. The connector must support fetching by ID.

Request field
Description

args

The connector, followed by the transformer arguments when transform is true.

namespace

The namespace to read from.

ids

The IDs to fetch.

transform, srcDataType, dstDataType

Apply a transform to the fetched documents.

dstNamespace

The namespace passed to the transformer, if different from namespace.

The response contains docs, each with id, data and missing, and the dataType of the documents. A document that the transform drops (through filter or self) is also reported as missing. If any document fails to transform, the whole request fails.

TestSync

Copies the given documents from the source to the destination through the regular sync pipeline, like the testsync command. The source connector must support fetching by ID.

Request field
Description

srcArgs, dstArgs

The source and destination connectors.

transformArgs, transform

The transformer, and whether to use it.

namespace

The source namespace.

dstNamespace

The destination namespace, if different. This is also the namespace the transformer receives.

ids

The IDs to copy.

srcDataType, dstDataType

Optional. Inferred if not set.

The response contains submitted, foundOnSource, missingOnSource and missingIds. It does not report whether each document was transformed and written successfully, and the request succeeds even when a batch fails. Follow up with VerifyIds, or read the destination.

VerifyIds

Compares documents by ID between source and destination, like the verify-ids command. Both connectors must support fetching by ID.

Request field
Description

srcArgs, dstArgs

The source and destination connectors.

transformArgs, transform

The transformer to apply to source documents before comparing.

namespace, dstNamespace

The source and destination namespaces.

namespaceMapping, mappingDelimiter

Namespace mapping, as on the command line.

ids

The source IDs to compare.

srcDataType, dstDataType

Optional. Inferred if not set. Without a transformer the two types must be equal, or the call fails.

reportLimit

Maximum number of problems to list. Default 100.

The response contains the counts total, matches, missingSrc, missingDst and mismatched, and issues with the id and status of each problem. status is one of VERIFY_ID_STATUS_MISMATCH, VERIFY_ID_STATUS_MISSING_SRC and VERIFY_ID_STATUS_MISSING_DST. With a transformer, total counts the documents the transformer produced. IDs missing on both sides are included in total but in none of the other counts or in issues.

API Service

Service name: adiom.api.v1.ApiService. It backs the Progress, Syncs and Workers sections of the user interface: reading progress, starting and cancelling local syncs, starting and controlling Temporal flows, and managing dynamic workers. Its methods take the same inputs as the corresponding forms in the user interface.

Last updated