Manage data contracts with CLI or API
You can interact with the Data Contract service through a CLI or direct API calls. You can also use the Collibra user interface to create or manage data contracts.
CLI
The Data Contract CLI packages API calls to enable automation and integration. Before you use the CLI, you need to install and configure it. Then, you can use its commands to create and maintain data contracts. You can perform the following tasks from the CLI. Detailed information and examples are available in the CLI.
| Command | Description | Permissions |
|---|---|---|
| collibra data-contract init |
Create a data contract with an initial manifest, or add a manifest to an existing, uninitialized Data Contract asset. |
|
| collibra data-contract draft | Generate a new manifest version based on Collibra metadata. |
|
| collibra data-contract push | Upload a new version of a manifest to Collibra. |
|
| collibra data-contract fetch | Retrieve a data contract. |
View permission on the Data Contract asset. |
| collibra data-contract list | List all data contracts and their metadata. | View permission on the Data Contract asset. |
| collibra data-contract list-versions | List versions and metadata for a data contract. | View permission on the Data Contract asset. |
| collibra data-contract set-active | Set a specific manifest version as active. |
|
| collibra data-contract clear |
Depending on the Clearing the data contract deletes all versions and unlinks the manifest ID from the contract. |
|
| collibra data-contract delete | Permanently delete a specific manifest version. |
|
Tip The CLI includes a --help flag to retrieve the built-in reference documentation, for example, ./collibra data-contract --help.
API
If you prefer to work directly with API calls, you do not need to set up the CLI. You can use any API tool, such as Postman, cURL, or Insomnia, to interact with the Data Contract service. Refer to the API specifications for detailed information about all available endpoints, including endpoints for listing contract metadata, managing versions, and setting the active version.
The required permissions are as follows.
| API endpoint | Permissions |
|---|---|
|
POST /dataContracts |
Note Initializing a data contract is the first step in linking a Data Contract asset to its initial manifest. By default, this creates a new Data Contract asset. To link the new asset to an existing governed asset (such as a Data Product Port), provide
governedAssetId. To create a standalone data contract with no governed asset, omit governedAssetId but provide domainId. To initialize an existing, uninitialized Data Contract asset, provide dataContractId instead. You can optionally provide an existing manifest to upload. If no manifest is provided during initialization, a template is generated from the associated Collibra metadata. Because a standalone data contract is not linked to a port, its generated template does not have a Schema section. Once a data contract is initialized, you can perform all other actions on it.
|
| GET /dataContracts | View permission on the Data Contract asset. |
| GET /dataContracts/{id} | View permission on the Data Contract asset. |
| DELETE /dataContracts/{id} |
|
| POST /dataContracts/addFromManifest |
|
| GET /dataContracts/{id}/draftVersion | View permission on the Data Contract asset. |
|
POST /dataContracts/{id}/apply |
Note The
apply endpoint applies the active manifest version to the Collibra knowledge graph. This creates and updates relations, and also updates the SLA attributes that match existing out-of-the-box SLA attributes on the Data Contract asset.
|
| POST /dataContracts/{id}/versions |
|
| DELETE /dataContracts/{id}/versions |
|
| GET /dataContracts/{id}/versions | View permission on the Data Contract asset. |
| GET /dataContracts/{id}/versions/manifest | View permission on the Data Contract asset. |
| GET /dataContracts/{id}/activeVersion | View permission on the Data Contract asset. |
| PATCH /dataContracts/{id}/activeVersion |
|
| GET /dataContracts/{id}/activeVersion/manifest | View permission on the Data Contract asset. |