Skip to main content

Public api

Intro

CAM-I provides a publicly available REST api that you can use to access your data. Only projects that you or your organization have created or that have been assigned to you (you are a recipient) can be accessed. You can use this feature to connect the CAM-I platform with your favorite tools like MS Power BI or create your own scripts in your preferred language.

Authentication

The first thing you will need to do before you can retrieve data, is to authenticate yourself so that the system can verify your access level. The following python code snippet demonstrates how to authenticate yourself:

import requests

login = {'email': 'your email address', 'password': 'your pwd'}
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
response = requests.post('https://api-dot-camera-inspector.appspot.com/token', headers=headers, json=login).json()

The body of the request needs to be a json structure with your email and password. The server will respond with another json object that contains the token that needs to be used to identify yourself for retrieving the data.

note

you can store this token and re-use it later on.

Projects

At the time of writing, the only supported publicly available api call allows you to retrieve a json list of all the projects available to you. The following options are available:

  • only new: You can select to only include projects that you haven't opened yet: filter=new
  • strands: you can also include the strand details for each project, but not the observations for each strand. include=streng

This api call requires you to include an 'authorization' header with the token that was previously retrieved through the authentication process. Here's a small code example:

url = 'https://api-dot-camera-inspector.appspot.com/project?include=streng'
headers = {'authorization': 'Bearer {}'.format(user['token']), 'Content-Type': 'application/json', 'Accept': 'application/json'}
data = requests.get(url, headers=headers).json()