Although complete Apple Health data can be queried via the Device Data methods, several specific methods exist to aggregate commonly-used data in useful ways.
MyDataHelps.queryAppleHealthActivitySummaries(queryParameters)
The daily activity summary reports on several common activity measures.
Filters data after this date, in ISO8601 format.
Filters data before this date, in ISO8601 format.
How many entries to include in each page of results. Default and maximum is 100.
Each page of results will return a nextPageID
if there are additional pages that can be queried. Supply that to pageID
to query the next page. When excluded, retrieves the first page.
Resolves to a result
object containing a page of activity summaries.
A list of AppleHealthActivitySummay data points filtered by the query parameters.
A unique identifier for this summary.
The active energy burned recorded by the Apple Watch, in kcal.
The goal for activeEnergyBurned
the participant set for themselves.
The total exercise time recorded by the Apple Watch, in minutes.
The goal for appleExerciseTime
the participant set for themselves.
The number of hours in the day during which the participant stood up for at least 1 minute.
The goal for appleStandHours
the participant set for themselves.
Start date/time for the summary, in ISO8601 format.
End date/time for the summary, in ISO8601 format.
Date when the data was stored by the system, in ISO8601 format.
Number of entries in the results
list.
An ID to be used with subsequent queries. Results from queries using this ID as the pageID
parameter will show the next page of results. This field is null if there isn’t a next page.
var queryParameters = {
startDate: "2021-02-18",
endDate: "2021-03-01T12:00:00-4:00",
pageSize: 100,
pageID: "c123b398-bf20-4b6f-989c-b0dcb4c3d75c"
};
MyDataHelps.queryAppleHealthActivitySummaries(queryParameters)
.then( function(result) {
console.log(result);
} );
var queryParameters = {
startDate: "2021-02-18",
endDate: "2021-03-01T12:00:00-4:00",
pageSize: 100,
pageID: "c123b398-bf20-4b6f-989c-b0dcb4c3d75c"
};
MyDataHelps.queryAppleHealthActivitySummaries(queryParameters)
.then( function(result) {
console.log(result);
} );
{
"nextPageID": "1f2464dd-7d05-421e-bd48-14b169f53fd1",
"totalResults": 100,
"results": [
{
"id": "c11bcf07-10f3-ed11-aac7-0afb9334277d",
"activeEnergyBurned": 610.317999999999,
"activeEnergyBurnedGoal": 340,
"appleExerciseTime": 64,
"appleExerciseTimeGoal": 30,
"appleStandHours": 13,
"appleStandHoursGoal": 12,
"startDate": "2023-05-14T00:00:00-04:00",
"endDate": "2023-05-14T23:59:59-04:00",
"insertedDate": "2023-05-15T11:02:53.74Z"
},
{
"id": "7d0c6f48-12f2-ed11-aac7-0afb9334277d",
"activeEnergyBurned": 437.63,
"activeEnergyBurnedGoal": 340,
"appleExerciseTime": 37,
"appleExerciseTimeGoal": 30,
"appleStandHours": 11,
"appleStandHoursGoal": 12,
"startDate": "2023-05-13T00:00:00-04:00",
"endDate": "2023-05-13T23:59:59-04:00",
"insertedDate": "2023-05-14T04:46:30.76Z"
},
...
]
}
{
"nextPageID": "1f2464dd-7d05-421e-bd48-14b169f53fd1",
"totalResults": 100,
"results": [
{
"id": "c11bcf07-10f3-ed11-aac7-0afb9334277d",
"activeEnergyBurned": 610.317999999999,
"activeEnergyBurnedGoal": 340,
"appleExerciseTime": 64,
"appleExerciseTimeGoal": 30,
"appleStandHours": 13,
"appleStandHoursGoal": 12,
"startDate": "2023-05-14T00:00:00-04:00",
"endDate": "2023-05-14T23:59:59-04:00",
"insertedDate": "2023-05-15T11:02:53.74Z"
},
{
"id": "7d0c6f48-12f2-ed11-aac7-0afb9334277d",
"activeEnergyBurned": 437.63,
"activeEnergyBurnedGoal": 340,
"appleExerciseTime": 37,
"appleExerciseTimeGoal": 30,
"appleStandHours": 11,
"appleStandHoursGoal": 12,
"startDate": "2023-05-13T00:00:00-04:00",
"endDate": "2023-05-13T23:59:59-04:00",
"insertedDate": "2023-05-14T04:46:30.76Z"
},
...
]
}
MyDataHelps.queryAppleHealthWorkouts(queryParameters)
The workout summary provides details about workouts the participant has recorded.
Filters data after this date, in ISO8601 format.
Filters data before this date, in ISO8601 format.
How many entries to include in each page of results. Default and maximum is 100.
Each page of results will return a nextPageID
if there are additional pages that can be queried. Supply that to pageID
to query the next page. When excluded, retrieves the first page.
Resolves to a result
object containing a page of workouts.
A list of AppleHealthWorkout data points filtered by the query parameters.
A unique identifier for this workout.
Start date/time for the workout, in ISO8601 format.
End date/time for the workout, in ISO8601 format.
Date when the data was stored by the system, in ISO8601 format.
Data source information, determined by the source application.
Device information, determined by the source application.
Additional metadata specified by the source application.
Detailed events that occurred within the activity (e.g., laps or pauses) specified by the source application.
Workout summary.
The type of workout.
The duration of the workout, in seconds (if recorded).
The energy burned during the workout, in kcal (if recorded).
The distance traveled during the workout, in meters (if recorded).
The number of swimming strokes during the workout (if recorded).
The flights of stairs climbed during the workout (if recorded).
Number of entries in the results
list.
An ID to be used with subsequent queries. Results from queries using this ID as the pageID
parameter will show the next page of results. This field is null if there isn’t a next page.
var queryParameters = {
startDate: "2021-02-18",
endDate: "2021-03-01T12:00:00-4:00",
pageSize: 100,
pageID: "c123b398-bf20-4b6f-989c-b0dcb4c3d75c"
};
MyDataHelps.queryAppleHealthWorkouts(queryParameters)
.then( function(result) {
console.log(result);
} );
var queryParameters = {
startDate: "2021-02-18",
endDate: "2021-03-01T12:00:00-4:00",
pageSize: 100,
pageID: "c123b398-bf20-4b6f-989c-b0dcb4c3d75c"
};
MyDataHelps.queryAppleHealthWorkouts(queryParameters)
.then( function(result) {
console.log(result);
} );
{
"nextPageID": "aeabdae1-75ca-4d8f-814a-a017818382d2",
"totalResults": 100,
"results": [
{
"id": "c956165b-78f2-ed11-aac7-0afb9334277d",
"startDate": "2023-05-14T11:58:40-04:00",
"endDate": "2023-05-14T12:33:03-04:00",
"insertedDate": "2023-05-14T16:57:11.247Z",
"summary": {
"activityType": "Swimming",
"duration": 2062.91047000885,
"totalEnergyBurned": 191.938478011434,
"totalDistance": 914.400024414063,
"totalSwimmingStrokeCount": 358,
"totalFlightsClimbed": null
},
...
]
},
...
]
}
{
"nextPageID": "aeabdae1-75ca-4d8f-814a-a017818382d2",
"totalResults": 100,
"results": [
{
"id": "c956165b-78f2-ed11-aac7-0afb9334277d",
"startDate": "2023-05-14T11:58:40-04:00",
"endDate": "2023-05-14T12:33:03-04:00",
"insertedDate": "2023-05-14T16:57:11.247Z",
"summary": {
"activityType": "Swimming",
"duration": 2062.91047000885,
"totalEnergyBurned": 191.938478011434,
"totalDistance": 914.400024414063,
"totalSwimmingStrokeCount": 358,
"totalFlightsClimbed": null
},
...
]
},
...
]
}