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.
- From your Collibra Platform
- 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. |
You can also consult the API documentation on the Collibra Developer Portal.
- In the REST APIs section, select the API you want to create a client for.
- Click Download the API schema under the page title.
- Save the file.
- Go to the API References section of the REST homepage.
- Select the API you want to create a client for.
- Click Download the API schema under the page title.
- 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:
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:
- In your command line, go to the directory with the JSON specification file.
- Execute the following command:
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:
- Download the file to your project root directory: collibra-core, in this example.
- Edit the file and provide the required values for the following variables:
- In your command line, go to the project root folder.
- Execute the following command to run main.py:
The terminal displays the following information:
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 '\\'
.