Elcies logo

Health Data Aggregator - ELCIES

ELCIES

Combine health and fitness data from dozens of apps into one

Collects and organizes data per user

  • Data

API reference on SwaggerHub API reference on Postman

Introduction

The Health Data Aggregator API links data from digital health wearables, devices and apps. This allows you to personalize your fitness, health and lifestyle services to individual users. Also, you can build your own intervention and prevention campaigns based on health and physical activity data. Examples of such data are steps, calorie consumption, weight, heart rate, sleep quality, blood pressure and glucose level.

Conceptual model

Conceptual model

Definitions

Tile

A tile represents a specific bit of data related to fitness, health or lifestyle. For instance, the activity tile represents a daily activity summary such as walking, running etc. Or data such calculated BMI, sleep log and body temperature.

API workflow

Sequence diagram

Features

  • Create spaces for your application
  • Add users to connect their devices to the application
  • Check information related to those users

Getting started

Authentication

OAuth 2.0

For accessing and/or manipulating the resources, the client application (your application) needs to be granted permission to do so. The OAuth 2.0 standard defines a protocol that allows such third party authorization through the use of access tokens. Access tokens are central in the protocol. These tokens, in the form of strings, are delivered by an authorization server (our authentication server) and they enable the client application to securely access protected data on behalf of the resource owner (the end user).

We use Client Credentials Grant. This means the application makes the request to the authentication service by sending authorization credentials. The service responds with an access token among other useful information.

Get access token

Copy your app's credentials and replace APP_CONSUMER_KEY and APP_CONSUMER_SECRET with the copied values, then execute the below cURL command to receive an access token.

curl -X POST  'https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials'  -H 'content-type: application/x-www-form-urlencoded'  -d 'client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET'

Note: If you are using cURL for Windows then please use the below command.

curl -X POST "https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials" -H "content-type: application/x-www-form-urlencoded" -d "client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET"

The authorization service returns a JSON message that contains the access token field.

{
    "refresh_token_expires_in": "0",
    "api_product_list": "[xxxxxxx]",
    "api_product_list_json": [
        " xxxxxxx"
    ],
    "organization_name": "kpn",
    "developer.email": "demo123@kpn.com",
    "token_type": "Bearer",
    "issued_at": "1521039195424",
    "client_id": "APP_CONSUMER_KEY",
    "access_token": "haf2SDl07E9N7RluNQ4kJ1TkGgso",
    "application_name": "6e38ed2d-48b1-4362-97d6-04254065d79c",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"
}

How to...

Register user

SwaggerHub:

  1. Create user with GET /connectedservice.
  2. Click Try it out.
  3. Supply ExternalUserId which is the ID of user.
  4. Click Execute.
  5. Check the response code and message. Use the callbackurl from the response in your application to connect with a device.

Postman:

  1. Create user.
  2. Click Send.
  3. Check the response code and message.

List user

SwaggerHub:

  1. List user with GET /userlist.
  2. Click Try it out.
  3. Click Execute.
  4. Check the response code and message.

Postman:

  1. List with (GET) User.
  2. Click Send.
  3. Check the response code and message.

Get tile detail

After the instructions, all the different tiles of information are listed.

SwaggerHub:

  1. Get tile detail with GET /tiledetail.
  2. Click Try it out.
  3. Fill out Param with userID, tilename and date.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Get tile detail with (GET).
  2. Fill out request queryparam userId, tilename and date.
  3. Click Send.
  4. Check the response code and message.
Code    Description
activitytile    Get daily activity summary (e.g. 'walking', 'running' - 'distance' only included when relevant)
caloriestile    The number of calories burned during the day for periods of time when the user was active
bmitile    Calculated BMI
bodywatertile    Track body water percentage
bonemasstile    Track bone mass percentage
musclemasstile    Track muscle mass percentage
sleeptypetile    The last measured sleep log entries for a given date range (including start and end dates)
bodytemperaturetile    Collects body temperature within seconds
bloodglucosetile    The last entries blood glucose
stepstile    The last measured steps
sleeptile    The last measured sleep log
cholesterolprofiletile    The last measured cholesterol
bloodpressuretile    The last measured blood pressure
weighttile    The last measured weight
heighttile    The last measured height
heartratetile    A heart rate monitor (HRM) measures the rate of a person's heartbeat
peaktile    Peak
cardiotile    Cardio information
fatburntile    Fat burn zone, which means your heart rate is 50 to 69% of maximum
calories_consumedtile    Calories consumed
carbs_consumedtile    Carbs consumed
fat_consumedtile    Fat consumed
protein_consumedtile    Protein consumed
sodium_consumedtile    Sodium consumed
sugar_consumedtile    Sugar consumed
iron_consumedtile    Iron consumed
calcium_consumedtile    Calcium consumed
vit_atile   Vitamin A
vit_ctile    Vitamin C
potasstile    The value of consumed potassium
choltile    The value of consumed cholesterol
trn_fattile    The value of consumed trans fat
mon_fattile    The value of consumed monounsaturated fat
ply_fattile    The value of consumed polyunsaturated fat
sat_fattile    The value of consumed saturated fat
water_consumedtile    The value of consumed water

Return codes

Code   Description
200   Success
201   Created
202   Accepted
302   Found. Link in location header
400   Bad request
401   Unauthorized
403   Forbidden
404   Not found
405   Method not allowed
412   Precondition failed
429   Too many requests
500   Internal server error
502   Bad gateway
503   Service unavailable

Changelog

Version   Description
v1.0   Initial version