Get your API key
To access the Cognite Data Platform you must get an API key. API keys will differ by project.
If you have a project with Cognite, generate one or talk to your project administrator. If not, obtain an API key for the publicdata project.
To do this go to openindustrialdata.com. Click Access Platform and fill out the registration form. Once you're redirected to your page you can click Generate your API key. You should copy and store this key somewhere safe (such as LastPass).
The API key generated from openindustrialdata.com is a read-only key. This means you can not create any data.
Postman is one of the most well known API tools out there, and it's very good for testing APIs and examining responses. Read more here
You can easily import our postman collection by clicking
Import -> Import from Link in Postman and paste in one of the urls below depending on which version you'd like.
https://storage.googleapis.com/cognite-postman-collections/openapi.0.5.json (stable, recommended)
Two variables should be set to use the Postman collection,
project. These can be set in an environment (recommended), or as collection variables.
api-key will be injected as the header to authenticate your requests, and the
project will route all your requests to the correct project.
Create environment variables
Create an environment by clicking the cog in the top-right corner of Postman, then click
Add. Give it a name, for example
VARIABLE, type in
api-key, and in the
CURRENT_VALUE field paste your api-key you generated earlier. Add another
project, and under
CURRENT_VALUE type in your project name. If you got your api key from openindustrialdata.com, the project name needs to be publicdata.
Add to create the environment. If you have multiple environments, you can swap between them with the dropdown menu in the top right corner. Select the one you just created if it isn't automatically selected.
Create collection variables
Create collection variables by right clicking on the collection
Cognite API in the left-hand side and click
Edit. Select the tab
Variables and do the same as described when creating environment variables.
Make your first request
Cognite API collection in the left-hand menu, select
List all assets (assuming 0.5). Clicking
Send should send a valid request and return a list of assets.
Params you can activate and fill in the different parameters. On post requests, the
Body tab controls the request body.
Step 1: Install Python 3
Follow the instructions in this file to setup your device.
Begin with installing Python3. If you're using a Mac, the easiest way to do this is by using Homebrew. Homebrew is a package manager for macOS that makes it easy to install software that you need.
- Open Terminal. You can do this by searching
Terminalin Spotlight Search (Cmd+Space)
brew -v. If you see the following pop up, skip to Step 6:
Homebrew x.x.x. If you don't see this, continue to the next step.
- To install Homebrew, go to https://brew.sh/.
- Copy the first line under
Install Homebrew. Paste it into Terminal, and hit Enter.
- Enter your password when prompted and wait for Homebrew to finish installing.
brew install python3in Terminal to install Python 3.
- Once installation is complete, run
python --version. If you see
Python 3.x.x, you're all set! If instead you see
Python 2.x.x, run
python3 --version– you will need to use the command
python3to run Python3 from now on.
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.6 python3.6-dev
python3.6 -m pip install --upgrade pip`
Download and install the latest release from here: https://www.python.org/downloads/windows/
Step 2: Install the Cognite Python SDK
Now that you have Python 3 installed you can install the Cognite Python SDK. To do this type
pip install cognite-sdk. You may need to use
pip3 install cognite-sdk if you installed
python3 with homebrew.
You can find examples and documentation for the SDK here.
Software Development Kit
To make your experience working with the Cognite Data Platform easier, we offer several software development kits, or SDKs: