Gateway Cloud API

The information below is a swagger definition for the SensorPush public API for the Gateway cloud. Download the swagger definition file here.

Note that requests can be made no more than once per minute. If you need support, please reach out to support@sensorpush.com, please be sure to preface your email subject with "[api]" so it reaches the correct team.

Important! To activate your API access, please log in to the Gateway Cloud Dashboard and agree to the terms of service. Once you've logged in that initial time, your account will have access. You can review the terms here.

Base URL:https://api.sensorpush.com
Version:
Schemes:https

Examples

The following illustrates how to interact with the API via simple curl commands.

Important FYI about tokens:

The authorization token is returned after a successful signin. This token identifies the user as a trusted client, and is valid for 60 minutes.

The authorization token is used to request two additional tokens: access and refresh tokens. The access token authorizes the user to begin using the API. This token is valid for 30 minutes, at which time the client must request a new access token using the refresh token.

The refresh token is valid for 60 minutes. Upon requesting a new access token, the client will receive new refresh token as well. The access token is valid for another 30 minutes, and the refresh token is again valid up to an additional 60 minutes.

These steps are in accordance with the oAuth2 specifications such that if any of the three tokens are lost, the tokens eventually expire, thus securing the account once again.

For additional information, please refer to the oAuth website.

Important FYI about Gateways:

A Gateway steadily relays sensor data roughly every minute. In addition to that, a Gateway will periodically check in with the cloud to make a record to indicate that that Gateway is on and connected to the SensorPush cloud via the internet. A Gateway’s check in can be observed by reading the “last_seen" property of a Gateway. Consider evaluating the “last_seen" property of a Gateway roughly every 15 minutes for a reliable indication of its status.

Example 1 - Step 1: Authorization

Log in using a valid email/password to recieve an authorization code.

Example 1 - Step 2: OAuth Access

Request a temporary oauth access token. Use the result from the previous step for the authorization code in the body.

Example 2: List Gateways

Request a list of gateways. Add the header "Authorization: " using the accesstoken returned in the OAuth Access step.

Example 3: List Sensors

Request a list of sensors. Add the header "Authorization: " using the accesstoken returned in the OAuth Access step.

Example 4: Query Samples

Request up to 20 samples occuring after a timestamp with this format YYYY-MM-DDThh:mm:ss.000Z, and also add the header "Authorization: " using the accesstoken returned in the OAuth Access step.

Data for temperature is in Fahrenheit.

Example 5: Query Samples for Specific Sensors and/or Specific Start and Stop Times

Similar to the "Query Samples" example, but with an added array for specific sensor IDs, and also added startTime and stopTime.

Security

Oauth

Name:

Authorization

In:

Header

Description:

This header value grants temporary access to data resources. Use the accesstoken value returned by the accesstoken service.