Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting Device Data via API

ANSWERED

Hi,

We have been trying to access the device data via API.

1. We have created the subscription and our application is receiving the alert when I sync my device data.

[ { collectionType: 'activities',
date: '2017-01-20',
ownerId: '4ZXXXX',
ownerType: 'user',
subscriptionId: '4ZXXXX' } ]

2. Once we receive the alert, we are calling this API to get the data. But it returns only the data we logged via Fitbit Web portal not the data we synced from the device.

https://api.fitbit.com/1/user/4ZXXXX/activities/date/2017-01-20.json

 

Please let me know if we are missing something.

 

Thanks

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @AndrewFitbit, We have found another API which returns the data we were expecting.

 

https://api.fitbit.com/1/user/4ZXXXX/activities/list.json?afterDate=2017-01-20&sort=asc&limit=20&off...

 

Thank you so much for your support.

 

 

View best answer in original post

Best Answer
0 Votes
6 REPLIES 6

@dilip_rajendran It's a summary of activity so it will include both. Have you checked the device's last sync time? Can I see the response you're getting?

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

@AndrewFitbit , when we called https://api.fitbit.com/1/user/4ZXXXX/activities/date/2017-01-20.json, we are getting the data manually logged in the Fitbit web portal NOT the data synced from the Fitbit device.

Please find the response below. These are the 5 entries we logged manually in Fitbit portal. Apart from these 5 entries, there are other steps data in the Fitbit portal for 20th Jan 2017 which we are not getting in the response.

Please help.

{
  "activities": [
    {
      "activityId": 17151,
      "activityParentId": 90013,
      "activityParentName": "Walk",
      "calories": 149,
      "description": "Walking less than 2 mph, strolling very slowly",
      "distance": 0.000706,
      "duration": 3600000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2017-01-20T13:54:49.000Z",
      "logId": 5658833367,
      "name": "Walk",
      "startDate": "2017-01-20",
      "startTime": "17:00",
      "steps": 1
    },
    {
      "activityId": 17151,
      "activityParentId": 90013,
      "activityParentName": "Walk",
      "calories": 149,
      "description": "Walking less than 2 mph, strolling very slowly",
      "distance": 0.008472,
      "duration": 3600000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2017-01-20T13:55:07.000Z",
      "logId": 5659655098,
      "name": "Walk",
      "startDate": "2017-01-20",
      "startTime": "17:00",
      "steps": 12
    },
    {
      "activityId": 17151,
      "activityParentId": 90013,
      "activityParentName": "Walk",
      "calories": 149,
      "description": "Walking less than 2 mph, strolling very slowly",
      "distance": 0.0706,
      "duration": 3600000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2017-01-20T13:57:44.000Z",
      "logId": 5658740340,
      "name": "Walk",
      "startDate": "2017-01-20",
      "startTime": "18:00",
      "steps": 100
    },
    {
      "activityId": 17151,
      "activityParentId": 90013,
      "activityParentName": "Walk",
      "calories": 13,
      "description": "Walking less than 2 mph, strolling very slowly",
      "distance": 0.0706,
      "duration": 300000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2017-01-20T13:58:56.000Z",
      "logId": 5658523290,
      "name": "Walk",
      "startDate": "2017-01-20",
      "startTime": "19:30",
      "steps": 100
    },
    {
      "activityId": 17151,
      "activityParentId": 90013,
      "activityParentName": "Walk",
      "calories": 0,
      "description": "Walking less than 2 mph, strolling very slowly",
      "distance": 0.0706,
      "duration": 600000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2017-01-20T14:30:23.000Z",
      "logId": 5658523296,
      "name": "Walk",
      "startDate": "2017-01-20",
      "startTime": "20:00",
      "steps": 100
    }
  ],
  "goals": {
    "activeMinutes": 30,
    "caloriesOut": 3059,
    "distance": 8.05,
    "floors": 10,
    "steps": 10000
  },
  "summary": {
    "activeScore": -1,
    "activityCalories": 781,
    "caloriesBMR": 1634,
    "caloriesOut": 2135,
    "distances": [
      {
        "activity": "Walk",
        "distance": 0.000706
      },
      {
        "activity": "Walk",
        "distance": 0.008472
      },
      {
        "activity": "Walk",
        "distance": 0.0706
      },
      {
        "activity": "Walk",
        "distance": 0.0706
      },
      {
        "activity": "Walk",
        "distance": 0.0706
      },
      {
        "activity": "total",
        "distance": 2.08
      },
      {
        "activity": "tracker",
        "distance": 2.79
      },
      {
        "activity": "loggedActivities",
        "distance": 0.220978
      },
      {
        "activity": "veryActive",
        "distance": 0
      },
      {
        "activity": "moderatelyActive",
        "distance": 0
      },
      {
        "activity": "lightlyActive",
        "distance": 2.08
      },
      {
        "activity": "sedentaryActive",
        "distance": 0
      }
    ],
    "elevation": 21.34,
    "fairlyActiveMinutes": 0,
    "floors": 7,
    "lightlyActiveMinutes": 250,
    "marginalCalories": 200,
    "sedentaryMinutes": 527,
    "steps": 2950,
    "veryActiveMinutes": 0
  }
}

 

Best Answer
0 Votes


@dilip_rajendran See within "summary":

 

       "activity": "tracker",
       "distance": 2.79
"elevation": 21.34,
    "fairlyActiveMinutes": 0,
    "floors": 7,
    "lightlyActiveMinutes": 250,
    "marginalCalories": 200,
    "sedentaryMinutes": 527,
    "steps": 2950,
    "veryActiveMinutes": 0

 Tracker data is there.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hi @AndrewFitbit,

I think that may help.

I will check this with my team on Monday.

 

Thanks

Best Answer
0 Votes

@dilip_rajendran Sure thing, let me know if you need any further clarification.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hi @AndrewFitbit, We have found another API which returns the data we were expecting.

 

https://api.fitbit.com/1/user/4ZXXXX/activities/list.json?afterDate=2017-01-20&sort=asc&limit=20&off...

 

Thank you so much for your support.

 

 

Best Answer
0 Votes