Using the REST API to manage console export files

In Collibra Console you can create export files manually or set up a schedule to automatically create export files at a set interval. You can achieve the same using the /consoleExport and /consoleExportSchedule endpoints of the CollibraManagement Console REST API.

Important Do not include any cookies in your requests. This results in a 403 - Forbidden error.

Create a console export file

Before you start, you must know the ID of the environment you want to create an export file for. You can retrieve it through the API or get it from Collibra Console:

Retrieve a list of all environments with a GET method of the /environment endpoint:

curl -L -X GET 'https://<your_collibra_console_url>/rest/environment' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>'

Response example:

[
    {
        "createdDate": 1699926678.042000000,
        "modifiedDate": 1699926678.042000000,
        "id": "a8f3ff8a-9bbd-43a2-833d-d54e96d4a798",
        "name": "Default environment",
        "serviceIdSet": [
            "3e50ee0f-d5dd-4935-9355-ad7da43a3eff",
            "13144bac-a319-45f6-b459-4e856a998488",
            "79c43e61-e51e-4f13-94f4-e27b9e94500f",
            "163342f3-4a7a-4cc8-b0c8-2b15ecfa31fa"
        ],
        "status": "RUNNING"
    }
]

In Collibra Console, go to the Environments tab and click the relevant environment to open its details. The environment ID appears in the address bar of your browser, after the colon sign.

Example https://console.collibra.com/#/environments/Environment:a8f3ff8a-9bbd-43a2-833d-d54e96d4a798

To create a console export file, use the POST method of the /consoleExport/{environmentId} endpoint and provide the export file information in a JSON body:

curl -L -X POST 'https://<your_collibra_console_url>/rest/consoleExport/<environment_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>' \
-d '{
    "name": "<console_export_file_name>",
    "description": "<console_export_file_description>",
    "dgcConsoleExportOptions": [
        "CUSTOMIZATIONS",
        "CONFIGURATION"
    ],
    "repoConsoleExportOptions": [
        "DATA",
        "HISTORY"
    ]
}'
import http.client
import json

conn = http.client.HTTPSConnection("<your_collibra_console_url>")
payload = json.dumps({
  "name": "<console_export_file_name>",
  "description": "<console_export_file_description>",
  "dgcConsoleExportOptions": [
    "CUSTOMIZATIONS",
    "CONFIGURATION"
  ],
  "repoConsoleExportOptions": [
    "DATA",
    "HISTORY"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic <Base64_username:password_encoded_values>'
}
conn.request("POST", "/rest/consoleExport/<environment_id>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': '<your_collibra_console_url>',
  'path': '/rest/consoleExport/<environment_id>',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Basic <Base64_username:password_encoded_values>'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "name": "<console_export_file_name>",
  "description": "<console_export_file_description>",
  "dgcConsoleExportOptions": [
    "CUSTOMIZATIONS",
    "CONFIGURATION"
  ],
  "repoConsoleExportOptions": [
    "DATA",
    "HISTORY"
  ]
});

req.write(postData);

req.end();
Important 
  • The name must not contain special characters.
  • description is an optional parameter.
  • The possible values for dgcConsoleExportOptions are "CUSTOMIZATIONS" and "CONFIGURATION". If you select none, you must add at least one of the repoConsoleExportOptions.
  • The possible values for repoConsoleExportOptions are "DATA" and "HISTORY". If you selected "HISTORY", you must also add "DATA". If you select none, you must add at least one of the dgcConsoleExportOptions.

Response example:

{
    "createdDate": 1699965108.223000000,
    "modifiedDate": 1699965108.223000000,
    "id": "d8c09773-f56e-49db-bfea-a2305ecbb219",
    "consoleExportInformation": {
        "name": "<console_export_file_name>",
        "description": "<console_export_file_description>",
        "appVersion": "2023.11",
        "createdByEmail": "<email_address>",
        "date": 1699965108.198000000,
        "consoleExportSpecificationId": "8eaac39e-2114-459b-9ca3-2b66b0ca5fdc",
        "environmentId": "a8f3ff8a-9bbd-43a2-833d-d54e96d4a798",
        "dgcConsoleExportOptions": [
            "CUSTOMIZATIONS",
            "CONFIGURATION"
        ],
        "repoConsoleExportOptions": [
            "HISTORY",
            "DATA"
        ]
    },
    "size": 0,
    "stepStateMap": {
        "REPOSITORY": {
            "status": "WAITING",
            "errorMessage": ""
        },
        "PRE_PROCESSING": {
            "status": "COMPLETED",
            "errorMessage": ""
        },
        "DGC": {
            "status": "WAITING",
            "errorMessage": ""
        },
        "POST_PROCESSING": {
            "status": "WAITING",
            "errorMessage": ""
        }
    },
    "inProgress": true
}

Download a console export file

Before you start, you must know the ID of the export file you want to download. You can see the ID in the response you get after creating an export file or you can use the GET method of the /consoleExport endpoint to retrieve a list of all the available files:

curl -L -X GET 'https://<your_collibra_console_url>/rest/consoleExport' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>'
import http.client

conn = http.client.HTTPSConnection("<your_collibra_console_url>")
payload = ''
headers = {
  'Authorization': 'Basic <Base64_username:password_encoded_values>'
}
conn.request("GET", "/rest/consoleExport", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': '<your_collibra_console_url>',
  'path': '/rest/consoleExport',
  'headers': {
    'Authorization': 'Basic <Base64_username:password_encoded_values>'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

Response example:

[
    {
        "createdDate": 1699965108.223000000,
        "modifiedDate": 1699965133.074000000,
        "id": "d8c09773-f56e-49db-bfea-a2305ecbb219",
        "consoleExportInformation": {
            "name": "<console_export_file_name>",
            "description": "<console_export_file_description>",
            "appVersion": "2023.11",
            "createdByEmail": "<email_address>",
            "date": 1699965108.198000000,
            "consoleExportSpecificationId": "8eaac39e-2114-459b-9ca3-2b66b0ca5fdc",
            "environmentId": "a8f3ff8a-9bbd-43a2-833d-d54e96d4a798",
            "dgcConsoleExportOptions": [
                "CUSTOMIZATIONS",
                "CONFIGURATION"
            ],
            "repoConsoleExportOptions": [
                "HISTORY",
                "DATA"
            ]
        },
        "size": 126533796,
        "stepStateMap": {
            "REPOSITORY": {
                "status": "COMPLETED",
                "errorMessage": ""
            },
            "PRE_PROCESSING": {
                "status": "COMPLETED",
                "errorMessage": ""
            },
            "DGC": {
                "status": "COMPLETED",
                "errorMessage": ""
            },
            "POST_PROCESSING": {
                "status": "COMPLETED",
                "errorMessage": ""
            }
        },
        "inProgress": false
    }
]

To obtain the download link for your console export file, use the GET method of the /consoleExport/file/{id}/link endpoint.

Note To avoid download disruptions, when using a firewall, ensure your network has access to AWS S3 and Google Cloud Storage endpoints, such as https://*.s3.amazonaws.com/*, https://*.s3.us-gov-west-1.amazonaws.com/*, or https://*.storage.googleapis.com/*.

curl -L -X GET 'https://<your_collibra_console_url>/rest/consoleExport/file/<console_export_file_id>/link' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>'
import http.client

conn = http.client.HTTPSConnection("<your_collibra_console_url>")
payload = ''
headers = {
  'Authorization': 'Basic <Base64_username:password_encoded_values>'
}
conn.request("GET", "/rest/consoleExport/file/<console_export_file_id>/link", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': '<your_collibra_console_url>',
  'path': '/rest/consoleExport/file/<console_export_file_id>/link',
  'headers': {
    'Authorization': 'Basic <Base64_username:password_encoded_values>'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

If you don't benefit from cloud storage, use the POST method of the /consoleExport/file/{id} endpoint.

Important You must include a 'Content-Type: application/x-www-form-urlencoded' header.

curl -L -X POST 'https://<your_collibra_console_url>/rest/consoleExport/file/<console_export_file_id>' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>' \
-o 'console-export.zip'

Tip To save the file locally, provide the -o option and the name of the file. In this example, the file is saved as console-export.zip in your current directory.

import http.client

conn = http.client.HTTPSConnection("<your_collibra_console_url>")
payload = ''
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Basic <Base64_username:password_encoded_values>'
}
conn.request("POST", "/rest/consoleExport/file/<console_export_file_id>", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var qs = require('querystring');

var options = {
  'method': 'POST',
  'hostname': '<your_collibra_console_url>',
  'path': '/rest/consoleExport/file/<console_export_file_id>',
  'headers': {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Basic <Base64_username:password_encoded_values>'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = qs.stringify({
  
});

req.write(postData);

req.end();

Delete a console export file

To delete a console export file, use the DELETE method of the /consoleExport/file/{id} endpoint.

curl -L -X DELETE 'https://<your_collibra_console_url>/rest/consoleExport/file/<console_export_file_id>' \
-H 'Authorization: Basic <Base64_username:password_encoded_values>'

Note If the operation succeeds, there is no response.