Create your own Collibra REST API client

In this tutorial you use the OpenApi Generator to create a Python REST API client for the Collibra Core REST API.

Since the Collibra REST APIs adhere to the OpenAPI Specification (OAS), you can use an OAS API generator to get a client in your preferred programming language.

Download the JSON specification

The OpenAPI Generator can read JSON specification files. You can download the JSON specification files for the Collibra REST APIs either from your Collibra Platform or from the Developer Portal.

The API references are part of your Collibra Platform environment. You need to be logged in to access them.

To access the API documentation:

User access API documentation
Sysadmin role

In the top-right corner of any Collibra page, click and select API documentation.

All roles In a browser, go to https://<your_collibra_url>/docs/index.html.
  1. In the REST APIs section, select the API you want to create a client for.
  2. Click Download the API schema under the page title.
  3. Save the file.

  1. Go to the API References section of the REST homepage.
  2. Select the API you want to create a client for.
  3. Click Download the API schema under the page title.
  4. Save the file.

Install OpenAPI Generator

Follow the OpenAPI Generator installation instructions for your operating system and preferred installation mode.

To install the OpenAPI Generator on a Windows machine using NPM, open a command line and execute the following command:

npm install @openapitools/openapi-generator-cli -g

Generate the client

Follow the OpenAPI Generator usage instructions to generate the API client.

To generate a Python client in a folder named collibra-core, with the package name collibra_core:

  1. In your command line, go to the directory with the JSON specification file.
  2. Execute the following command:
    openapi-generator-cli generate -g python -i dgc-rest.json -o collibra-core --package-name collibra_core

    If you don't provide a package name, it defaults to openapi_client.

Connect to your Collibra Platform

Use the sample main.py to connect to your Collibra Platform:

  1. Download the file to your project root directory: collibra-core, in this example.
  2. Edit the file and provide the required values for the following variables:
    collibra_url = ""
    username = ""
    password = ""
  3. In your command line, go to the project root folder.
  4. Execute the following command to run main.py:
    python .\main.py

The terminal displays the following information:

Platform version: <full_version>
Platform build number: <build_number>
You are connected as: <first_name> <last_name> (<user_name>)
You have access to <asset_count> business terms.

If the command cannot be executed due to missing any of the dependencies listed in requirements.txt, install the required dependencies.

Next steps

To install the package, follow the Python Installing Packages tutorial, usually pip install collibra_core inside virtual environments or pip install --user collibra_core.

Generate clients for the other Collibra REST API applications.

To successfully use the generated Collibra REST Import API package, you must manually update the files in /<package_name>/modules and replace any occurrence of '\' with '\\'.

Additional resources