API integrations

MetaCroc logo

Integrations #

MetaCroc provides several APIs for integration with other tools or for publications of metadata.

APIs #

More information about APIs is in API description page.

In all URLs, it is necessary to replace [tenant] by your tenant name.

Token #

For access to API, it is necessary to obtain access token first. For this purpose, there is an API exposed form this purpose.

POST: https://[tenant].metacroc.com/auth/realms/tenat/protocol/openid-connect/token

request: header: content_type: application/x-www-form-urlencoded

body:

grant_type client_credentials
client_id User ID from API users settings
client_secret Secret from API users settings
For client_id and client_secret, create a new API user (an option available in Settings/API users).

response body:

{
  "access_token": "bearer token value",
  "expires_in": 300,
  "refresh_expires_in": 0,
  "token_type": "Bearer",
  "not-before-policy": 0,
  "scope": "email profile"
}

Add the access_token in to Authorization header for every request

Authorization: Bearer access_token

Async API #

Async API provides information about started asynchronous task. Is is possible to get information about the task status and the final result in other API calls. There is an example of API that exports a set of element metadata to a file.

Task start #

POST: https://[tenant].metacroc.com/api/mdd-backend/api/structure/export

Use this API to start export task asynchronously. taskId is returned for requesting status of the task or its result.

Get export status #

GET https://[tenant].metacroc.com/api/mdd-backend/api/structure/export/:taskId

Use this API to check a status of a running export.

Get export result file #

GET https://[tenant].metacroc.com/api/mdd-backend/api/structure/export/:taskId/result

Use this API to get a result export defined by taskId.

Sync API #

All sync APIs return the result immediately. Here is a list of APIs, details are described in Swagger.

Read table data #

GET /api/table/{tableId}

API returns a full data of a table defined by tableId

Update table data #

PUT /api/table/{tableId}

Use this API to update data in a table.

Data is replaced by content sent via this API (not updated by sent fields).

Read mapping data #

GET /api/mapping/{mappingId}

API returns a full data of a mapping defined by mappingId

Update mapping data #

PUT /api/mapping/{mappingId}

Use this API to update data in a mapping.

Data is replaced by content sent via this API (not updated by sent fields).

Add elements to a deployment package #

POST /api/system/{systemName}/deployment-package/{dpName}/structure

Use this API to add one or more elements to a deployments package.

Create a new element #

POST /api/structure/{parentId}/children/{type}

Use this API to create a new element as a child of other element.

Generate a script for a single element #

POST /api/structure/{id}/export/{objectTypeId}

MetaCroc generates an output of selected element with a given object type (which defines a selection of a template).

Mark element as deployed #

POST /api/structure/{id}/deploy/{deploymentId}

Use this API to mark an element as deployed (e.g. from CI/CD pipeline).

POST /api/structure/deployed

This API makes the same using a deployment file generated during pushing the output to the git.

Get a list of deployment packages #

GET /api/system/{systemName}/deployment-package

This API returns a list of open deployment packages.

Project tree #

GET /api/system/{name}/tree

This Api returns a list of an all elements in a tree.

RAW data #

GET /api/structure/{structureId}/raw-data

This API returns data sent to template.

Element data #

GET /api/structure/{id}

This API returns a the latest version of data of an element.

Object types #

GET /api/object-type

This API returns all object types defined in Settings/Object Types