This API returns list of users currently signed up to use Spire Healthtag devices for a study or research project. This API just needs access token as input.
Query Params
None
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 -
[
{
"user_id": 0,
"email": "string",
"sex": "female",
"birthdate": "2019-02-21",
"first_name": "string",
"height_in_cm": 0,
"weight_in_kg": 0,
"baseline_rr": 0,
"baseline_rr_conf_interval": 0,
"baseline_rrv": 0,
"baseline_rrvstd": 0,
"resting_heart_rate": 0,
"active_minutes_goal": 60,
"steps_goal": 10000,
"sleep_hours_goal": 8,
"bedtime": "string"
}
]
Response Code | Description |
---|---|
200 | Successful Operation |
401 | Access token is missing or invalid |
403 | Not a valid key value pair in Authorization header |
404 | The requested API could not be found. Please review your URL |
429 | Too many requests hit the API too quickly |
Output Data
Field Name | Type | Description |
---|---|---|
user_id | Integer | Unique ID to identify a user |
String | Login email address of the user | |
sex | String | Gender of the the person - - female - male |
birthdate | String | Date of birth of the user |
first_name | String | First Name of the user |
height_in_cm | Float | Height of the user |
weight_in_kg | Float | Weight of the user |
baseline_rr | Float | Baseline respiratory rate is current value of median of respiratory rates while user is resting (i.e. not sleeping or active). Also, very high quality respiratory rates (i.e. respiratory confidence interval <= 0.6) are used for this calculation |
baseline_rr_conf_interval | Float | No device can predict respiratory rate 100% accurately . Confidence interval helps define a range in which true respiratory rate is likely to be there. There is a 95% probablity that true respiratory rate is within 2 respiratory rate confidence interval (i.e. between rr + 2*rr_conf_interval and rr - 2*rr_conf_interval) range. baseline_rr_conf_interval is median of respiratory confidence interval |
baseline_rrv | Float | Baseline respiratory rate variability is current value of median of respiratory rates variablity while user is resting (i.e. not sleeping or active). Also, very high quality respiratory rates (i.e. respiratory confidence interval <= 0.6) are used for this calculation. For more detail on RRV, see Output Data section of Processed physiological time series data API |
baseline_rrvstd | Float | Current value of median of standard deviation of Respiratory Rates |
resting_heart_rate | Float | Current value of average heart rate while user is resting |
active_minutes_goal | Integer | Active minutes goal for the day |
steps_goal | Integer | Number of steps goal for the day |
sleep_hours_goal | Integer | Sleep hours goal of the day |
bedtime | String | Time at which user plans to go to bed |
Program samples to test out API
Use the program samples below to test out APIs with your own research data -
cURL
curl --request GET \
--url https://research-api.spire.io/v1/users \
--header 'Authorization: Bearer 284e8f3320a8500c58ea5b8e7829bdd676ea941bb573bb250d51c0b82f68e19d' \
--header 'accept: application/json'
Python
Python program sample below calls Users API to get users data and saves the data into a Pandas data frame.
import requests
from http import HTTPStatus
import pandas as pd
headers = {'Authorization': str('Bearer 284e8f3320a8500c58ea5b8e7829bdd676ea941bb573bb250d51c0b82f68e19d'), 'Content-type': 'application/json'}
params = {}
user_list = requests.get(f'https://research-api.spire.io/v1/users', params=params, headers=headers)
if user_list.status_code == HTTPStatus.OK:
user_list_pandas = pd.DataFrame(user_list.json(),columns=user_list.json()[0].keys())
print (user_list_pandas.head())
else:
print ("Returned status code is: " + str(user_list.status_code))
print (user_list.text)