Hello.
I'm trying to get the distance swam data for my android/ios app.
I would like to use this endpoint
GET /1/user/[user-id]/[resource-path]/date/[base-date]/[end-date].json
But this only gives "distance" which seems to be walking/running data. So i tried using this one which gives a lot more detail:
GET https://api.fitbit.com/1/user/[user-id]/activities/date/[date].json
This one gave me this activity data in response for the day I took a swim:
"activities": [
{
"activityId": 90024,
"activityParentId": 90024,
"activityParentName": "Swim",
"calories": 314,
"description": "less than 25 yards/min",
"distance": 0,
"duration": 2355000,
"hasActiveZoneMinutes": false,
"hasStartTime": true,
"isFavorite": false,
"lastModified": "2020-09-06T12:24:34.000Z",
"logId": 34073552772,
"name": "Swim",
"startDate": "2020-09-06",
"startTime": "13:40",
"steps": 0
}
],
As you can see under "name" it is indeed a Swim, but the distance says 0, even though you can see the duration was quite long.
If i look inside the fitbit app, there is no "distance kilometers" data but a "lengths" data:
It is in Swedish (sorry), but you can see it displays a length property instead of kilometers, is there anyway to retrieve this length property instead of distance (which gives me 0) in the web API?
Thanks
Answered! Go to the Best Answer.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
For your use case, the Get Activity Log List endpoint will not provide distance, but it will provide you with the number of "swimLengths".
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @calleman123
The best endpoints to get exercise stats are either the Get Daily Activity Summary or the Get Activity Log List endpoints. Any of the data you see in the mobile application will come through in the API. It sounds like the device didn't record distance. You might need to set the default lap length first. Here's an article that describes everything about the swim exercise and getting it enabled on your device, https://help.fitbit.com/articles/en_US/Help_article/2087.htm#How.
It could also be related to the device that you're using. Which device are you using while swimming?
Best Answer@Gordon-CThanks so much for taking your time to help.
I'm using a FitBit Inspire (not the HR). This one cannot set the lap length, it should be automatically tracked:
Indeed it didn't track my distance, but it tracked the laps as you can see in the imgur link. So i'm still not sure what might be going on...
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @calleman123, would you please private message me your Fitbit User ID? Let me see if I can determine where the lap data might be available.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
For your use case, the Get Activity Log List endpoint will not provide distance, but it will provide you with the number of "swimLengths".