Get up and running with our API libraries and start working with Cognite Data Fusion in a few simple steps:
To get set up, watch this video or see the text below for details:
Step 1: Get your API key
Cognite Data Fusion authenticates your API requests using the API key for a project. If you do not include a key when you make an API request, or use one that is incorrect or outdated, Cognite Data Fusion returns an error.
You can test your setup with an API key and data from the Open Industrial Data project, if you don't have your own project yet. The API key generated for the Open Industrial Data project is a read-only key, and you can not create or change any data in the project:
- Navigate to openindustrialdata.com, click Access Platform and fill out the registration form.
- Once you're redirected to your page, scroll down and click Generate your API key. Copy and store your API key in a safe location (for example in LastPass).
Make sure you keep your API key secret, like you would with a password. Do not share it with others.
Step 2: Make a test API request
We recommend that you download, install and use Postman to test API requests and verify responses.
In Postman, on the left side bar click Import > Import From Link and enter a URL to import Postman collection:
You can see your newly imported collection in the sidebar.
projectenvironment variables. The
api-keyis injected as the header to authenticate your requests, and the
projectroutes all your requests to the correct project in Cognite Data Fusion. To set the environment variables:
Click Environment quick look (eye) icon in the top-right corner. Click Add and enter an Environment Name, for example
Under VARIABLE, enter
api-key, and in the CURRENT_VALUE field enter your API key.
Add another VARIABLE, name it
project, and in the CURRENT_VALUE field enter the name of your project.
We recommended that you work with the current value of a variable to prevent sharing sensitive and confidential information with your team.
If you got your API key from the Open Industrial Data Project, enter
publicdataas the name of the project.
Click Save to save the environment variables you have added.
If necessary, select your newly created environment in the dropdown menu in the top right corner.
Make a test API request to check that your integration is working correctly:
Click the Cognite API collection in the left-hand menu, and select Assets > List assets.
Cognite Data Fusion returns a list of all asset objects in response to your API request. For the Open Industrial Data project the JSON results look similar to this:
"description": "VRD - PH 1STSTGGEAR THRUST BRG OUT",
"WMT_TAG_CREATED_DATE": "2009-06-26 15:36:37",
"WMT_TAG_DESC": "VRD - PH 1STSTGGEAR THRUST BRG OUT",
"WMT_TAG_UPDATED_DATE": "2014-07-11 09:25:15"
Once you have successfully made an API request, you’re ready to begin interacting with the Cognite Data Fusion API through our Software Development Kits (SDKs).
Step 3: Install a Software Development Kit (SDK)
The Python Software Development Kit (SDK)
The Cognite Python SDK requires Python 3.5+ and provides access to the Cognite Data Fusion API from applications written in the Python language. For detailed information, see the Cognite Python SDK Documentation.
To download and install Python, visit Python.org.
To install the Cognite Python library:
pip install cognite-sdk
npm install @cognite/sdk --save
yarn add @cognite/sdk