Quickstart

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).

WARNING

The API key generated from openindustrialdata.com is a read-only key. This means you can not create any data.

Postman

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.3.json (deprecated)

https://storage.googleapis.com/cognite-postman-collections/openapi.0.4.json (deprecated)

https://storage.googleapis.com/cognite-postman-collections/openapi.0.5.json (stable, recommended)

https://storage.googleapis.com/cognite-postman-collections/openapi.0.6.json (experimental)

Variables

Two variables should be set to use the Postman collection, api-key and project. These can be set in an environment (recommended), or as collection variables. The 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 cognite-publicdata. Under VARIABLE, type in api-key, and in the CURRENT_VALUE field paste your api-key you generated earlier. Add another VARIABLE called 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.

Click 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

Click the Cognite API collection in the left-hand menu, select Assets -> List all assets (assuming 0.5). Clicking Send should send a valid request and return a list of assets.

Under Params you can activate and fill in the different parameters. On post requests, the Body tab controls the request body.

Python

Step 1: Install Python 3

Follow the instructions in this file to setup your device.

macOS

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.

  1. Open Terminal. You can do this by searching Terminal in Spotlight Search (Cmd+Space)
  2. Type 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.
  3. To install Homebrew, go to https://brew.sh/.
  4. Copy the first line under Install Homebrew. Paste it into Terminal, and hit Enter.
  5. Enter your password when prompted and wait for Homebrew to finish installing.
  6. Type brew install python3 in Terminal to install Python 3.
  7. 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 python3 to run Python3 from now on.

Ubuntu

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6 python3.6-dev
1
2
3

Upgrade pip

python3.6 -m pip install --upgrade pip`
1

Windows

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:

Last Updated: 1/10/2019, 11:28:47 AM