851 Transport Drive • Valparaiso, IN 46383 (USA)
Phone: 219.465.2700 • www.GasLeakSensors.com
SENSIT Connect API
Instructions
2
CONTENTS
SENSIT CONNECT API CALLS ����������������������������������������������������������������� 3
LOGGING IN/AUTHENTICATION ����������������������������������������������������������� 3
RESPONSE ...........................................................................................................3
POSTMAN EXAMPLE:.............................................................................................4
JAVASCRIPT EXAMPLE: ...........................................................................................4
PYTHON EXAMPLE: ...............................................................................................5
GETTING DEVICES �������������������������������������������������������������������������������� 6
RESPONSE ...........................................................................................................6
POSTMAN EXAMPLE..............................................................................................7
JAVASCRIPT EXAMPLE ............................................................................................7
PYTHON EXAMPLE ................................................................................................8
GETTING HISTORICAL DATA ������������������������������������������������������������������ 8
RESPONSE ...........................................................................................................9
POSTMAN EXAMPLE..............................................................................................9
JAVASCRIPT EXAMPLE ...........................................................................................10
PROVIDES DATA FOR A FULL DAY. EACH POST RETURNS DATA FOR 2 HOURS. ...........10
PYTHON EXAMPLE ................................................................................................11
GET DATES WITH AVAILABLE DATA ������������������������������������������������������� 11
RESPONSE ...........................................................................................................12
POSTMAN EXAMPLE..............................................................................................12
JAVASCRIPT EXAMPLE ............................................................................................13
PYTHON EXAMPLE ................................................................................................13
NOTES ������������������������������������������������������������������������������������������������� 14
3
SENSIT CONNECT API CALLS
This document details the necessary API calls to extract data from SENSIT Connect.
PLEASE NOTE: This document has examples that may have different device types you are using. Please
modify any location where it calls out a specific device type (SPOD, FMD, RAMP) to the device type that
you are using. This is extremely important in the URL step. The document outlines the URLs for all three
device types further down.
LOGGING IN/AUTHENTICATION
To get the authentication token from SENSIT Connect, send a HTTP POST to
https://api.sensitconnect.net/users/signin
The following stringified JSON needs to be included I the raw BODY of the POST.
{
password: XXXXXXX
}
RESPONSE
The response of this POST is a JSON containing the following parameters. The most important
parameters are the “id” within the “user” object, and “accessToken.
4
All subsequent API calls will require the returned credentials, specifically “id” and “Token. The token
must be provided in the “Authorization” header of all HTTP POST or GETs.
POSTMAN EXAMPLE:
JAVASCRIPT EXAMPLE:
var key = “”
var SENSITConnect = “https://api.sensitconnect.net/users/signin
var date = new Date()
let params = {
email: document.getElementById(username”).value,
password: document.getElementById(password”).value
}
postData(SENSITConnect,params).then((data) => {
console.log(data) }
})
async function postData(url = ‘’,data = {}){
const response = await fetch(url,{
method: “POST,
mode: “cors,
cache: “no-cache,
5
credentials: “same-origin,
headers: {
“Content-Type”: “application/json
},
redirect: “follow”,
referrerPolicy: “no-referrer”,
body: JSON.stringify(data)
})
return response.json()
}
PYTHON EXAMPLE:
import requests
import json
url = “https://api.sensitconnect.net/users/signin
payload = json.dumps({
email”: “INPUT EMAIL HERE”,
password”: “INPUT PASSWORD HERE”
})
headers = {
‘Content-Type’: ‘application/json
}
response = requests.request(“POST, url, headers=headers, data=payload)
print(response.text)
6
GETTING DEVICES
Once you have the token, the user can query the historical data by device name. To get a list of devices
assigned to the user, send a HTTP GET request to:
https://api.sensitconnect.net/clients/getDevicesFromDeviceTypeAndRole?
The following “PARAMS” need to be set:
Key Value
DeviceType ALL
Role FROM LOGIN
UserId FROM LOGIN
Note that the authorization header must be set with the bearer token, discussed in the logging in/
Authentication section.
RESPONSE
The response will contain an array of Objects, each containing:
{
“_id”: “DEVICE ID”,
uuid”: “1041”,
“key”: “”,
name”: “METEC 1041”,
“location”: “Valparaiso,
picture”: “”,
status”: “Active,
“type”: “DEVICE TYPE”,
“isUTCTimeZone”: false,
“isFirmwareUpdateRequire”: false,
“isCharging”: false,
“lastReceivedRecord”: OBJECT CONTAINING THE LAST RECEIVED RECORD,
“battery”: 0
}
The contents of “lastReceivedRecord” depends on the type of device. See the corresponding manual of
the device for more information.
7
POSTMAN EXAMPLE
JAVASCRIPT EXAMPLE
getData(device_url.query,{
DeviceType: “ALL,
Role: login_cred.user.role,
UserId: login_cred.user.id,
},login_cred.accessToken).then((data) => {
console.log(data)
})
})
async function getData(url = ‘’,data = {},token = ‘’){
get_url = url + new URLSearchParams(data)
const response = await fetch(url + new URLSearchParams(data),{
method: “GET,
mode: “cors,
cache: “no-cache,
credentials: “same-origin,
headers: {
Authorization: “Bearer “ + token
},
redirect: “follow”,
referrerPolicy: “no-referrer”
})
return response.json()
}
8
PYTHON EXAMPLE
import requests
url = “https://api.sensitconnect.net/clients/getDevicesFromDeviceTypeAndRole?Device-
Type=ALL&Role=SystemAdministrator&UserId=659dcc1c6fddf00fabc8cccd”
payload = “”
headers = {
Authorization’: ‘Bearer INSERT YOUR TOKEN HERE’
}
response = requests.request(“GET, url, headers=headers, data=payload)
print(response.text)
GETTING HISTORICAL DATA
After device IDs associated with the account has been queried – historical data from the FMD can be
queried using:
https://api.sensitconnect.net/sensors-data/getFMDDeviceLogForGivenHour
The following stringified JSON needs to be included I the raw BODY of the POST.
{
“DeviceID”: “INSERT YOUR DEVICE ID HERE”
“StartDate”: “INSERT YOUR START DATE HERE”
“EndDate”: “INSERT YOUR END DATE HERE”
}
9
RESPONSE
The data response from this call is an array of JSON Objects, each containing parameters of the
specific device type that was queried. See each corresponding manual for a dictionary of the returned
parameters.
POSTMAN EXAMPLE
10
JAVASCRIPT EXAMPLE
PROVIDES DATA FOR A FULL DAY. EACH POST RETURNS DATA FOR 2 HOURS.
async function load_data(date,device){
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
tmp_date = date
tmp_data = []
let url = data_url[device.type]
for (let i=0;i<12;i++){
start_date = tmp_date.setHours(2*i)
startDate = tmp_date.getUTCFullYear() + ‘-’ + (tmp_date.getUTCMonth() + 1) + ‘-’ + tmp_date.
getUTCDate() + ‘ ‘ + tmp_date.getUTCHours() + “:00:00”
end_date = tmp_date.setHours(2*(i+1))
endDate = tmp_date.getUTCFullYear() + ‘-’ + (tmp_date.getUTCMonth() + 1) + ‘-’ + tmp_date.
getUTCDate() + ‘ ‘ + tmp_date.getUTCHours() + “:00:00”
query = {
“DeviceId”: device.uuid,
“DeviceType”: device.type,
“StartDate”: startDate,
“EndDate”: endDate
}
if (start_date < new Date()){
test_data = await postData(url,query,token)
tmp_data = tmp_data.concat(test_data.data.reverse())
}
}
return tmp_data
}
async function postData(url = ‘’,data = {},token = ‘’){
busy = 1
const response = await fetch(url,{
method: “POST,
mode: “cors,
cache: “no-cache,
credentials: “same-origin,
headers: {
Authorization: “Bearer “ + token,
“Content-Type”: “application/json
},
11
redirect: “follow”,
referrerPolicy: “no-referrer”,
body: JSON.stringify(data)
})
busy = 0
return response.json()
}
PYTHON EXAMPLE
import requests
import json
url = “https://api.sensitconnect.net/sensors-data/getFMDDeviceLogForGivenHour”
payload = json.dumps({
“DeviceId”: “1028”,
“StartDate”: “2024-02-05 22:00:00”,
“EndDate”: “2024-02-05 24:00:00”
})
headers = {
‘Content-Type’: ‘application/json,
Authorization’: ‘Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InN5c3RlbWFkb-
WluQHNlbnNpdGNvbm5lY3QubmV0Iiwicm9sZSI6IlN5c3RlbUFkbWluaXN0cmF0b3IiLCJkaXNwbG-
F5TmFtZSI6IlN5c3RlbSBBZG1pbiIsInN0YXR1cyI6IkFjdGl2ZSIsImlhdCI6MTcxMDM0MTk4MiwiZXhwIjox-
NzEwMzcwNzgyfQ.nUTHyFfk9DbeVPXe31He2mrsG9ZS0HSgqPa-z02ipvk
}
response = requests.request(“POST, url, headers=headers, data=payload)
print(response.text)
GET DATES WITH AVAILABLE DATA
There is an API call for providing dates with available data. The API is an HTTP POST to:
Device Type URL
FMD https://api.sensitconnect.net/sensors-data/getFMDDataAvailableDates
SPOD https://api.sensitconnect.net/sensors-data/getSPODDataAvailableDates
RAMP https://api.sensitconnect.net/sensors-data/getRAMPDataAvailableDates
The following stringified JSON needs to be included in the BODY of the HTTP POST.
{
“DeviceId”: “INSERT YOUR DEVICE ID”,
“DeviceType”: “INSERT YOUR DEVICE TYPE”,
“Timezone”: “INSERT YOUR TZ IDENTIFIER TIMEZONE HERE. E.G. America/Chicago
}
12
While SENSIT Connect works in UTC, the time zone is required because whether data is available on a
given day is dependent on the timezone (i.e. data at 12/23/2023 1:30 EST is on 12/23/2023, but if
queried in PST, it should be 12/22/2023).
RESPONSE
The data response from this HTTP POST is an array of JSON objects. A prototypical object is provided
below:
{
“_id”: {
month”: 9,
day”: 29,
year”: 2023
},
count”: # OF DATA POINTS AVAILABLE ON THIS DAY,
date”: “LAST DATA POINT WITHIN THIS DAY”
}
POSTMAN EXAMPLE
13
JAVASCRIPT EXAMPLE
async function get_available(device){
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
let url = available_url[device.type]
tmp_available = await postData(url,{
“DeviceId”: device.uuid,
“DeviceType”: device.type,
“Timezone”: timezone
},token)
return tmp_available
}
PYTHON EXAMPLE
import requests
import json
url = “https://api.sensitconnect.net/sensors-data/getFMDDataAvailableDates
payload = json.dumps({
“DeviceId”: “1024”,
“DeviceType”: “FMD”,
“Timezone”: “America/Chicago
})
headers = {
‘Token’: ‘Bearer INSERT YOUR BEARER TOKEN HERE’,
‘Content-Type’: ‘application/json,
Authorization’: ‘Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InN5c3RlbWFkb-
WluQHNlbnNpdGNvbm5lY3QubmV0Iiwicm9sZSI6IlN5c3RlbUFkbWluaXN0cmF0b3IiLCJkaXNwbG-
F5TmFtZSI6IlN5c3RlbSBBZG1pbiIsInN0YXR1cyI6IkFjdGl2ZSIsImlhdCI6MTcxMDM0MTk4MiwiZXhwIjox-
NzEwMzcwNzgyfQ.nUTHyFfk9DbeVPXe31He2mrsG9ZS0HSgqPa-z02ipvk
}
response = requests.request(“POST, url, headers=headers, data=payload)
print(response.text)
14
NOTES
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
15
NOTES
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
__________________________________________________________________________________________
16
851 Transport Drive
Valparaiso, IN 46383-8432
Phone: 219.465.2700
Fax: 219.465.2701
Email: info@gasleaksensors.com
Website: www.GasLeakSensors.com
MADE IN THE USA
WITH GLOBALLY SOURCED COMPONENTS