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

incorrect activity returned

ANSWERED

first try. powershell, $token is my correct token and i can log in.

 

$headers = @{Authorization="Bearer $token"}

 

# i can see my user profile with this command:

(invoke-restmethod -uri https://api.fitbit.com/1/user/-/profile.json -Method get -Headers $headers -ContentType application/json).user

 

the command below tells me that my best day of steps was Feburary 28, 2016, at 10,072 steps. spoiler alert: this is not accurate, i've  had more than that four times so far this week. .

 

(invoke-restmethod -uri https://api.fitbit.com/1/user/-/activities.json -Method get -Headers $headers -ContentType application/json).best.total.steps

 

am i misunderstanding the point of best.total.steps?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

nevermind. nothing to do with the api. just fitbit being fitbit. it's - impressively - wrong on the dashboard as well. one web page says both "you've earned the 20k/day steps badge!" and "your best day is 10k steps!" (i added a screenshot, but the forum ate it.)

Capture3.JPG

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

if i loop through one day at a time starting on January 1 2016 ,.i can get the results, a lot of which are higher than what the best.total.steps is telling me. but of course, i'm only allowed 150 api calls per hour, and January 1 2016 was 2,534 days ago. so it'd take around 17 hours to get every day into an array i can sort to find the actual best.total.steps. 

$startDate = Get-Date  (two zero one six dash zero one dash zero one # because this forum won't permit me to post that numerical date in yyyy-MM-dd format)
$endDate = Get-Date
while($startDate -le $endDate) {
   $nextDate = Get-Date $startDate -format yyyy-MM-dd
   (invoke-restmethod -uri "https://api.fitbit.com/1/user/-/activities/steps/date/$nextdate/1d/1min.json" -Method get -Headers $headers -ContentType application/json).'activities-steps'
   $startDate = $startDate.AddDays(1)

Best Answer
0 Votes

nevermind. nothing to do with the api. just fitbit being fitbit. it's - impressively - wrong on the dashboard as well. one web page says both "you've earned the 20k/day steps badge!" and "your best day is 10k steps!" (i added a screenshot, but the forum ate it.)

Capture3.JPG

Best Answer
0 Votes