The exchange API exports a data product to a standard file format and imports such a file back. It supports ODPS 4.2 YAML (export and import) and OSI YAML (export only). There is no screen for ODPS: you call the API, for example from a script that keeps data products in git or exchanges them with another catalog.
Calls use the same authentication as every other endpoint: a bearer token or the cookie session. For how to get a token for a service, see Machine identity for services.
Formats come from packages
The formats and their field mappings are not built into the platform. They ship in packages, in two sections:
exchangeFormatsdeclares a format: its key, whether it can export or import, and its schema.exchangeMappingsdeclares how an object’s fields map to the file.
The Data Product Standard package ships two formats:
| Format | Key | Direction |
|---|---|---|
| ODPS 4.2 | core_data_product_standard#odps (or odps) | Export and import |
| OSI | core_data_product_standard#osi (or osi) | Export only |
In a URL, write the # as %23.
The list of formats is built from the installed package versions each time a package is installed or removed; no restart is needed. A patch package can override a format or mapping, or add a new one. Uninstalling the patch restores the base definition.
If the installed version of the package has no exchange sections, the list of formats is empty and every call returns 404 Exchange format '…' does not exist. Install a package version that carries the sections.
List formats
GET api/exchange/formats?objectId={objectId}
Returns the formats the installed packages offer. With objectId, only the formats that fit that object are listed (for a data product, odps and osi; for a domain, none). It needs read access to the object.
Export a data product
GET api/exchange/{format}/objects/{objectId}
Returns the file as application/yaml, named <productID>.yaml. Exporting the same unchanged product twice gives byte-identical files.
Add ?report=true to get JSON instead, with the file, the mapping report, and the schema validationErrors.
Export needs read access to the object. A draft (concept) object is exported only to users who may read the draft: its creator, a sharee, or a space admin. Related objects the caller can’t read (the domain, or OSI tables, columns, ports and foreign keys) are left out of the file.
OSI export is synchronous and returns 400 when the product has no exportable tables. The “Export objects” dialog is a separate, background route; see Export a data product as OSI YAML.
Import a data product
POST api/exchange/{format}/import?spaceId={spaceId}&dryRun={true|false}
Send the ODPS YAML as the request body. The response holds a status, the changes, the report, and validationErrors.
| Status | Meaning |
|---|---|
CREATED | A new data product was created. |
UPDATED | An existing data product was changed. |
UNCHANGED | The file matches the product; no new version is written. |
SKIPPED | Nothing was written, for example DOMAIN_NOT_FOUND. |
Invalid YAML returns 400 with the line and column. An unknown format returns 404.
Field mapping
The ODPS mapping for a data product covers 12 fields:
- Name, product ID, type, description, value proposition, visibility, tags, and status.
- The business domain, by name.
- Owner, steward, and producer, by e-mail, in the
x-dawisoblock.
Descriptions are Markdown in the file and HTML in Dawiso. Links using http, https, or mailto are kept; unsafe links are unwrapped. Anything not in the mapping, such as contract, is reported and dropped.
Identity and create rules
- Identity is
product_idonly, tenant-wide.x-dawiso.objectIdis exported for reference and ignored on import. A file whose product ID was changed creates a new product. Two live products with the same ID returnIDENTITY_AMBIGUOUSand nothing is written. - Create puts the product in
spaceId, under the domain of that name in that space only. A missing or ambiguous domain givesDOMAIN_NOT_FOUNDorDOMAIN_AMBIGUOUSand the product is skipped. - Update writes only the changed fields. Users are added, never removed.
- Parallel imports of the same identity are serialized, so posting one file several times at once gives one object.
Status
Status is set directly, without a workflow transition, and only to a state the user’s role may enter. An administrator can always set it. Otherwise the report shows NOT_WRITABLE for the status and the rest of the document is still imported. Because the status is set directly, notifications and automations that run on a transition don’t fire.
Dry run
dryRun=true returns the same status, changes, and report as a real run and writes nothing. A create dry run returns objectId: null. Document-level schema validation and create-time rights that depend on the new object are not checked in a dry run.
Permissions
Importing needs the Admin or Contributor role. Creating needs write access to spaceId, and updating needs write access to the matched object. Otherwise the call returns 403 and nothing is written.
Report codes
Field-level report issues (unknown fields, unmapped values, NOT_WRITABLE fields, and schema problems) don’t stop the rest of the document from being written. A SKIPPED result, for example DOMAIN_NOT_FOUND, writes nothing.
| Code | Meaning |
|---|---|
UNMAPPED_PATH | A key in the file is not in the mapping, for example a top-level contract. It is dropped. |
UNMAPPED_VALUE | A value has no mapping, for example visibility: internal. The field is left unchanged. |
NOT_WRITABLE | The user can’t set the field: a status the role may not enter, an attribute the role may not edit, a comment that is required, or a conditional date rule. |
EMPTY | An OSI port has no tables. |
SCHEMA_ERROR | The schema could not be loaded. |
validationErrors lists problems against the format’s JSON Schema, each with a path and a message. Validation is advisory: an invalid document is still imported.
The first schema validation after the API starts can take about 30 seconds, because the schema is compiled in the background. Later calls take a fraction of a second. The first ?report=true export or import after a start waits once.