Devices API
Get Body Data
Returns body data from all of the specified users' connected providers.
GET
/
body
Authorization
Query
curl --request GET \
--url https://api.sandbox.metriport.com/body \
--header 'x-api-key: <x-api-key>'
import { MetriportDevicesApi } from "@metriport/api-sdk";
const metriportClient = new MetriportDevicesApi("YOUR_API_KEY");
const response = await metriportClient.getBodyData("metriportUserId", "date");
Query Params
userId
string
requiredThe Metriport user ID to create a session token for.
date
string
requiredDay for which to pull the data. Formatted YYYY-MM-DD
.
For simplicity, all queries assume the UTC timezone for the specified date
starting at 00:00 to 23:59 - unless otherwise specified by the timezoneId
parameter.
timezoneId
string
Timezone ID to use for the specified date. If not specified, the UTC timezone is used.
For example this can be valid timezones like America/Los_Angeles
or Europe/Kiev
.
Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
Support for this parameter is under development, and currently only supported for the Google Fit provider.
Response
body
Body[]
An array of body objects for each of the user’s connected providers
[
{
"metadata": {
"date": "2022-12-21",
"source": "withings"
},
"body_fat_pct": 9,
"bone_mass_kg": 33,
"height_cm": 189,
"lean_mass_kg": 43,
"muscle_mass_kg": 22,
"weight_kg": 78,
"weight_samples_kg": [
{
"time": "2022-12-21T19:42:20.000Z",
"value": 78,
"data_source": {
"source_type": "DEVICE",
"id": "1234",
"name": "Body Cardio",
"type": "Scale"
}
}
]
}
]
curl --request GET \
--url https://api.sandbox.metriport.com/body \
--header 'x-api-key: <x-api-key>'
import { MetriportDevicesApi } from "@metriport/api-sdk";
const metriportClient = new MetriportDevicesApi("YOUR_API_KEY");
const response = await metriportClient.getBodyData("metriportUserId", "date");