Fitbit API无法获取通过Fitbit设备同步的数据,即Blaze

时间:2016-12-01 07:19:22

标签: php api fitbit

我正在尝试使用以下链接获取数据: - https://dev.fitbit.com/docs/activity/和API: - GET https://api.fitbit.com/1/user/[user-id]/activities/date/[date].json并获取响应数组,如下所示

Array(
[result] => Array
    (
        [activities] => Array
            (
                [0] => Array
                    (
                        [activityId] => 90013
                        [activityParentId] => 90013
                        [activityParentName] => Walk
                        [calories] => 25
                        [description] => Walking less than 2 mph, strolling very slowly
                        [distance] => 0.271426
                        [duration] => 355000
                        [hasStartTime] => 1
                        [isFavorite] => 
                        [lastModified] => 2016-11-29T19:11:42.000Z
                        [logId] => 5007419020
                        [name] => Walk
                        [startDate] => 2016-11-30
                        [startTime] => 00:34
                        [steps] => 342
                    )

            )

        [goals] => Array
            (
                [activeMinutes] => 30
                [caloriesOut] => 2157
                [distance] => 8.05
                [floors] => 10
                [steps] => 10000
            )

        [summary] => Array
            (
                [activeScore] => -1
                [activityCalories] => 55
                [caloriesBMR] => 1257
                [caloriesOut] => 1300
                [distances] => Array
                    (
                        [0] => Array
                            (
                                [activity] => Walk
                                [distance] => 0.271426
                            )

                        [1] => Array
                            (
                                [activity] => total
                                [distance] => 0.48
                            )

                        [2] => Array
                            (
                                [activity] => tracker
                                [distance] => 0.42
                            )

                        [3] => Array
                            (
                                [activity] => loggedActivities
                                [distance] => 0.271426
                            )

                        [4] => Array
                            (
                                [activity] => veryActive
                                [distance] => 0.09
                            )

                        [5] => Array
                            (
                                [activity] => moderatelyActive
                                [distance] => 0.11
                            )

                        [6] => Array
                            (
                                [activity] => lightlyActive
                                [distance] => 0.16
                            )

                        [7] => Array
                            (
                                [activity] => sedentaryActive
                                [distance] => 0.12
                            )

                    )

                [elevation] => 0
                [fairlyActiveMinutes] => 5
                [floors] => 0
                [heartRateZones] => Array
                    (
                        [0] => Array
                            (
                                [caloriesOut] => 37.9099
                                [max] => 98
                                [min] => 30
                                [minutes] => 25
                                [name] => Out of Range
                            )

                        [1] => Array
                            (
                                [caloriesOut] => 33.193
                                [max] => 137
                                [min] => 98
                                [minutes] => 9
                                [name] => Fat Burn
                            )

                        [2] => Array
                            (
                                [caloriesOut] => 0
                                [max] => 166
                                [min] => 137
                                [minutes] => 0
                                [name] => Cardio
                            )

                        [3] => Array
                            (
                                [caloriesOut] => 0
                                [max] => 220
                                [min] => 166
                                [minutes] => 0
                                [name] => Peak
                            )

                    )

                [lightlyActiveMinutes] => 6
                [marginalCalories] => 33
                [sedentaryMinutes] => 1426
                [steps] => 789
                [veryActiveMinutes] => 3
            )

    )

[code] => 200
[content_type] => application/json;charset=UTF-8

但问题是这个数组只是提供了使用Fitbit应用程序完成的活动数据。但我必须获取完整的数据,无论是Fitbit应用程序还是Fitbit设备,即blaze。

1 个答案:

答案 0 :(得分:0)

只需看一眼API,我相信您需要使用activities/tracker/。 API声明这表示仅由跟踪器设备记录的每日活动值,不包括手动活动日志条目。因此,您只需将tracker添加到GET

跟踪器活动:

activities/tracker/calories  
activities/tracker/steps  
activities/tracker/distance  
activities/tracker/floors  
activities/tracker/elevation  
activities/tracker/minutesSedentary  
activities/tracker/minutesLightlyActive  
activities/tracker/minutesFairlyActive  
activities/tracker/minutesVeryActive  
activities/tracker/activityCalories