Skip to main content
Infogrid REST API v1
Dan Allen avatar
Written by Dan Allen
Updated over 12 months ago

Endpoint

The REST API is available at https://api.infogrid.io/v1/swagger

How to create a service account

In order to use the API you must have a Service Account.

To create a new service account, use the left menu to navigate to the Users view in the webapp. In the top-right corner, next to the Add user button there is a dropdown with additional options - click on the arrow and choose “Add service account” (see image).

Remember: if you don’t see this button, service accounts have not been enabled for your organisation. Please contact our support team if you like to use this feature.

A dialogue window will open, where you need to enter a name for your service account. Upon saving you will be redirected to the service account detail view, where you will see a section “Access credentials for this service account”. There you will find both an access and a secret key for this account which can be used to authenticate using the /auth/token/ endpoint - see the Authentication section for more details. Be sure to store the secret key somewhere safe, as it will not be shown again and cannot be retrieved elsewhere, as we do not store secret keys in plaintext.

If you have lost your secret key, or you believe it has been compromised, when you open the service account detail view once more, under the same header “Access credentials” you can generate a new secret key. It is then no longer possible to gain access to the API using the previous secret key.

Permissions

Note that after creating a service account it is still required to set the appropriate permissions for it, similar to setting permissions for users. The API only returns elements that the service account has permission to read.

Pagination

Each list operation described below is paginated using the following parameters:

Name

In

Type

Required

Description

page

query

number

false

A page number within the paginated result set.

page_size

query

number

false

Number of results to return per page.

The response of a list operation has the following schema:

Name

Description

count

Number of results

next

The URL of the next page

previous

The URL of the previous page

results

The result list

In most examples below pagination has been omitted for brevity.

API Base URL

Use this url in conjunction with endpoint signatures described below.

Authentication

Create access token

POST /auth/token

Takes a set of access credentials and returns access and refreshes JWT token to be used to authenticate protected resources.

To create access credentials, log into our platform and create a service account. See above for detailed instructions about how to do that. With a service account, you can retrieve your access and secret keys.

This operation does not require authentication

Verify access token

POST /auth/token/verify

Takes a token and indicates if it is valid.

This operation does not require authentication. Please note that the response returns HTTP 200 OK with an empty response if the token is valid.

Using the access token

For the protected endpoints following below, use the access token in the header of your requests.

Authorization: Bearer <ACCESS_TOKEN>

Organizations

List organizations

GET /org

Lists all available organizations for the service account.

Get organization

GET /org/{id}

Get details of a specific organization.

Folders

List folders

GET /org/{organization_pk}/folders

Returns all folders (including subfolders) of an organization.

Get folder

GET /org/{organization_pk}/folders/{id}

Get details of a specific folder.

Get subfolders of a folder

GET /org/{organization_pk}/folders/{folders_pk}/subfolders

List subfolders of a specific folder.

Sensors

List sensors of a folder

GET /org/{organization_pk}/folders/{folders_pk}/sensors

List sensors

GET /org/{organization_pk}/sensors

List all available sensors.

Get sensor

GET /org/{organization_pk}/sensors/{deviceId}

Get details of one specific sensor.

Events

Get latest events of all available sensors

GET /org/{organization_pk}/sensors/latest-events

Fetches the latest events for each event type of all available sensors.

Get events of a sensor

GET /org/{organization_pk}/sensors/{sensor_pk}/events

To receive events from sensors it is recommended to use the above endpoint. Currently this endpoint will only show events from the past 3 months and any events you wish to access which are older than that should be accessed from the endpoint below.

You can define which fields you would like to receive about each event with the fields query parameter where you have the option of profile_id, timestamp, type, value, server_timestamp, source_id, event_id where the former four are the defaults.

To be able to limit and work through your results, you can use the following request parameters:

  • from_time

  • to_time

Both are ISO 8601 timestrings in the format of: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]

For example a request could be:

GET /org/{organization_pk}/sensors/{sensor_pk}/events?from_time=2020-03-13T14:00&to_time=2020-03-13T15:00

Did this answer your question?