This API is used to fetch data on device activation. Once a pack of devices is given to a research participant, it's important that research participant activate the devices by pairing with Spire Health mobile application. Based upon data returned by this API, research owner can understand if device is activated or not. It also provides information on who activated the device and when. If a research paricipant doesn't activate the device, research owner may need to follow up with that user.

Headers

This API just requires API Access Token available at the Research portal. Set this up as HTTP header before calling the API.

Response format

This API returns User data in a JSON format -
[
{
"pack_id": 0,
"device_id": "string",
"is_registered": "string",
"registered_email": "string",
"time_zone": "string",
"paired_at": "2019-02-21T04:16:16.965Z",
"last_connected": "2019-02-21T04:16:16.965Z",
"firmware": "2019-02-21T04:16:16.965Z",
"raw_capture_setting": "2019-02-21T04:16:16.965Z"
}
]

Response CodeDescription
200Successful Operation
401Access token is missing or invalid
403Not a valid key value pair in Authorization header
404The requested API could not be found. Please review your URL
429Too many requests hit the API too quickly

Output Data

Field NameTypeDescription
pack_idIntegerPack id of the devices
device_idStringSerial number of the device
is_registeredStringIndicates whether device is registered or not
registered_emailStringIndicates whether device is registered or not
time_zoneStringTimezone in which data was captured. For example - 'America/Chicago','Australia/Brisbane','Europe/Stockholm'. More detailed list available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
paired_atdate-timeDate on which device was paired
last_connecteddate-timeDate on which device connected last time
firmwareStringNote that Firmware version of the device
raw_capture_settingStringIndicates whether raw data capture is enabled or not

Program samples to test out API

Use the program samples below to test out APIs with your own research data -

cURL

curl -X GET \
  https://research-api.spire.io/v1/device_compliance \
  -H 'Authorization: Bearer 9f33707110d21885da378b7482e530492de0a1b2b0d279172112357b975f4fc1'

Python

Python program sample below calls Device compliance API to get device compliance data and saves the data into a Pandas data frame.


import requests
from http import HTTPStatus
import pandas as pd

headers = {'Authorization': str('Bearer 9f33707110d21885da378b7482e530492de0a1b2b0d279172112357b975f4fc1'), 'Content-type': 'application/json'}
device_compliance = requests.get(f'https://research-api.spire.io/v1/device_compliance', headers=headers)
if device_compliance.status_code == HTTPStatus.OK:
    device_compliance_pandas = pd.DataFrame(device_compliance.json(),columns=device_compliance.json()[0].keys())
    print (device_compliance_pandas.head())
else:
    print ("Returned status code is: " + str(device_compliance.status_code))
    print (device_compliance.text)
    
Language
Authorization
Bearer
JWT
URL