Hello,
When I get a list of activities, one of the properties is "detailsLink" for a particular activity. For example, the value is https://api.fitbit.com/1/user/-/activities/25510163315.json . When I go to the endpoint defined in the activity via a GET HTTP request, I get the following error:
{"errors":[{"errorType":"validation","fieldName":"logId","message":"Invalid activity log id: 25510163315"}]}How can I get this to work?
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 @cwt137,
Can you provide me with a screenshot of where you are seeing "detailsLink" as I am unfamiliar with this property?
Also, is logId 25510163315 an activity found under your account? or a different user's account?
Hope to hear from you soon!
Best AnswerHere is a snippet from the JSON response that includes the detailsLink property. This is my activity and I tried to get it with my API credentials.
{
"activities": [
{
"activeDuration": 1266000,
"activityLevel": [
{
"minutes": 0,
"name": "sedentary"
},
{
"minutes": 0,
"name": "lightly"
},
{
"minutes": 0,
"name": "fairly"
},
{
"minutes": 21,
"name": "very"
}
],
"activityName": "Run",
"activityTypeId": 90009,
"calories": 293,
"caloriesLink": "<a href="https://api.fitbit.com/1/user/-/activities/calories/date/2019-09-24/2019-09-24/1min/time/5:16/5:37.json" target="_blank">https://api.fitbit.com/1/user/-/activities/calories/date/2019-09-24/2019-09-24/1min/time/5:16/5:37.json</a>",
"detailsLink": "<a href="https://api.fitbit.com/1/user/-/activities/25510163315.json" target="_blank">https://api.fitbit.com/1/user/-/activities/25510163315.json</a>",
"distance": 3.276453,
"distanceUnit": "Kilometer",
"duration": 1271000,
"elevationGain": 0,
"lastModified": "2019-09-24T12:44:09.000Z",
"logId": 25510163315,
"logType": "tracker",
"manualValuesSpecified": {
"calories": false,
"distance": false,
"steps": false
},
"originalDuration": 1271000,
"originalStartTime": "2019-09-24T05:16:03.000-07:00",
"pace": 385.5923685605161,
"source": {
"id": "105592021",
"name": "Ionic",
"trackerFeatures": [
"PACE",
"GPS",
"VO2_MAX",
"ELEVATION",
"DISTANCE",
"STEPS",
"CALORIES",
"HEARTRATE"
],
"type": "tracker",
"url": "<a href="https://www.fitbit.com/" target="_blank">https://www.fitbit.com/</a>"
},
"speed": 9.336284360189573,
"startTime": "2019-09-24T05:16:03.000-07:00",
"steps": 3289,
"tcxLink": "<a href="https://api.fitbit.com/1/user/-/activities/25510163315.tcx" target="_blank">https://api.fitbit.com/1/user/-/activities/25510163315.tcx</a>"
}
],
"pagination": {
"afterDate": "2019-09-23T01:00:00",
"limit": 10,
"next": "",
"offset": 0,
"previous": "",
"sort": "asc"
}
}
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.
@cwt137 It appears that you are attempting to use the GET Activities TCX endpoint, but instead you are actually using the GET Activity Type endpoint.
If you are trying to use the Get Activities TCX endpoint, your URL request should end with .tcx not .json, so it should look like this:
https://api.fitbit.com/1/user/-/activities/25510163315.tcx
If you leave the .json in the URL, you will end up using the GET Activity Type endpoint. The URL looks like this:
https://api.fitbit.com/1/activities/[activity-id].json
In this case, it appears that you are entering the <logId> (logId=25510163315) where the <activity-id> attribute is, which is causing this error.
To see a list of activity-id's, you'll need to execute the GET Browse Activity Types endpoint.
I hope this helps. Let me know if you have any additional questions.
Best Answer