Payload Data Plotting

Plot any set of points using our path graph type!

Now we can plot any data that comes with Terra's data payloads, read more to learn how.

1) Find what data you want to plot and form the graph type as instructed:

{
  "data" : [
    {
      "MET_data": {
        ...
      },
      "heart_rate_data":{
        "detailed":{
          ...
        },
        "summary":{
          "avg_hr_bpm": 59.197080291970806,
          "avg_hrv_rmssd": null,
          "avg_hrv_sdnn": null,
          "hr_zone_data": [],
          "max_hr_bpm": 88,
          "min_hr_bpm": 43,
          "resting_hr_bpm": null,
          "user_max_hr_bpm": null
        },
        "metadata": {
          "end_time": "2023-11-21T00:00:00.000000-06:00",
          "start_time": "2023-11-20T00:00:00.000000-06:00",
          "upload_type": 1
        },
        ...
    	},
      ...
    ]
}

If the user is interested in plotting max_hr_bpm from the daily payload example under summary and heart_rate_data, the graph type to be specified would be daily.heart_rate_data.summary.max_hr_bpm. To plot similar data values the format would be data type (daily, sleep, etc...) followed by the path and separated with .characters.

2) Create the graph through the endpoint

Create a post request using the InitializeGraphSession endpoint, and specify type as explained.

curl --request POST \
     --url https://api.tryterra.co/v2/graphs/ \
     --header 'dev-id: <YOUR DEV ID>' \
     --header 'x-api-key: <YOUR API KEY>' \
     --data '
{
  "type": "daily.heart_rate_data.summary.max_hr_bpm",
  "bgcolor": "FFFFFF",
  "linecolor": "FFF000"
}
'

3) Visit the created graph session combined with user id to view the specified path data for the user