09-20-2022 07:26
09-20-2022 07:26
Hi,
I have a questions regarding the activity types that are provided by the API.
When I try to retrieve all activity types, as described here, like so: https://api.fitbit.com/1/activities.json I receive a large list of activity types, including types like "Coal mining", "Run", and also "Standing - bathing dog".
A few problems with this list of activities types:
Thanks!
09-21-2022 07:33
09-21-2022 07:33
Hi @thomasmol
I don't have personal historical knowledge about the activity database. However, I can only guess, whether or not Fitbit uses them, we provide the list of activities for 3rd party applications to use within their application.
1. Fitbit lists the exercises in the device and web / mobile application of the most popular exercises.
2. The duplicate aerobics activity is likely a custom activity the user created. I'm struggling to delete the custom activities as well, and I'm not seeing anything in the help articles. I'd recommend reaching out to the main customer support team at https://help.fitbit.com for assistance. They support the devices and web / mobile application.
3. I'm not able to reproduce retrieving a custom activity from the database. For example, I created a custom activity called "Tango". Activity ID 88665503 was created for this activity. I queried the following endpoints
Get Activity Type - /1/activities/{activity-id}.json
{ "activity": { "accessLevel": "PRIVATE", "hasSpeed": false, "id": 88665503, "mets": -1, "name": "Tango" } }
Browse Activity Types - /1/activities,json (at the bottom of the list are your private (custom) activities)
{ "accessLevel": "PRIVATE", "hasSpeed": false, "id": 88665503, "mets": -1, "name": "Tango" },
Activity ID 91047 is part of our public database. I can get information when I call the Get Activity Type endpoint (1/activities/91047.json)
{ "activity": { "accessLevel": "PUBLIC", "hasSpeed": false, "id": 91047, "mets": 6, "name": "Aerobics" } }
I hope this helps!
Gordon
12-15-2022 10:36 - edited 12-15-2022 23:47
12-15-2022 10:36 - edited 12-15-2022 23:47
Hi Gordon,
Thanks for your answer, it helps a little.
The problem is this:
The response of this call:
GET https://api.fitbit.com/1/activities.json
Gives a pretty long list of activity types and even 'sub'types, like activity levels, and all their unique IDs.
However, this list does not seem to be exhaustive.
For example, if I log an activity in the Fitbit app, or webapp, I can search for an activity type. Some activity types are shown double, like in the screenshot below.
They do not seem to be any different form the user's perspective, they have the same data input and same name, etc.
I logged both of these activity types for Aerobics, first the top suggestion and then the bottom one. Then I fetched all my activities using the Fitbit Web API. This is that result:
{
"activities": [
{
"activeDuration": 751000,
"activityLevel": [
{ "minutes": 0, "name": "sedentary" },
{ "minutes": 0, "name": "lightly" },
{ "minutes": 13, "name": "fairly" },
{ "minutes": 0, "name": "very" }
],
"activityName": "Aerobics",
"activityTypeId": 91047,
{
"activeDuration": 1800000,
"activityLevel": [
{ "minutes": 0, "name": "sedentary" },
{ "minutes": 0, "name": "lightly" },
{ "minutes": 0, "name": "fairly" },
{ "minutes": 30, "name": "very" }
],
"activityName": "Aerobics",
"activityTypeId": 90005,
}
]
}
As you can see, they have different 'activityTypeId's. The big problem is that the activityTypeId of 90005 is found in the list of activity types when fetching the Get All Activity Types call using 'https://api.fitbit.com/1/activities.json', but the activityTypeId of 91047 cannot be found in this list.
The interesting thing is that when you try to fetch a single activity type using https://api.fitbit.com/1/activities/[id].json both of these ids do give a result, both with activity type names of 'Aerobics'. Also both types have an access level of 'PUBLIC'.
This seems to be an indication that the GET https://api.fitbit.com/1/activities.json does not give an exhaustive list of all activity types. Which is interesting because the documentation even specifies to "At startup, we recommend your application retrieve the complete list of activities, cache the results and display the results in the application’s UI later." But this list does not seem complete? Where can I find it?
12-15-2022 13:16
12-15-2022 13:16
I can work with engineering to see if we can update the output from the Get all Activity Types endpoint. The problem associated with duplicate activities shown in the web application needs to be reported to the main customer support team at https://help.fitbit.com.
I will provide an update for you on the Get All Activity Types endpoint when I hear back from engineering.
Gordon