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

Json object names are different from your example

ANSWERED

I was testing intraday-time-series-api to get "activities/calories" resources, and noticed that json elements names in the response are different from your example. To be specific, I called "/1/user/activities/calories/date/today/today/15min.json" expecting "activities-log-calories-intraday" and "activities-log-calories" elements, but actually received "activities-calories-intraday" and "activities-calories" (without "log"). 

 

I just wanna make sure if these current object names are "correct", and not going to be changed in the future.

 

Thanks,

- Hoon

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hello Hoon.

The version that has "log" word in it is legacy version.

You can achieve "activities-log-calories-intraday" by changing your URI to be 

/1/user/-/activities/log/calories/date/today/today/15min.json

instead of 

/1/user/-/activities/calories/date/today/today/15min.json

 

however I'd suggest you to use new format that does not have word "log" in it.

For more information please refer to this page: https://wiki.fitbit.com/display/API/API-Get-Time-Series

Ivan Bahdanau
Senior Software Developer at Fitbit

View best answer in original post

Best Answer
8 REPLIES 8

Hello Hoon.

The version that has "log" word in it is legacy version.

You can achieve "activities-log-calories-intraday" by changing your URI to be 

/1/user/-/activities/log/calories/date/today/today/15min.json

instead of 

/1/user/-/activities/calories/date/today/today/15min.json

 

however I'd suggest you to use new format that does not have word "log" in it.

For more information please refer to this page: https://wiki.fitbit.com/display/API/API-Get-Time-Series

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer

Thanks for your quick response 😄

Best Answer
0 Votes

Hi,

 
Can you please advise me how to access to the intraday level data in coding, e.g. hourly? (I have already got the access permission) I looked at the https://wiki.fitbit.com/display/API/API-Get-Time-Series but could not figure out what should I put in the loggables data, is it "activities/log/steps/intraday" instead of  "activities/log/steps". In addition, regarding the URL, could you please advise me.
for instance I am using the following URL but getting "Error in downloading", is it related to the loaggables data or the URL?
var LOGGABLES = ["activities/log/steps", "activities/log/distance",
"activities/log/activityCalories",
"activities/log/calories",
"activities/log/minutesSedentary",
"activities/log/minutesLightlyActive",
"activities/log/minutesFairlyActive",
"activities/log/minutesVeryActive", ];
 
var date = "2014-09-15"; 
var result = UrlFetchApp.fetch("https://api.fitbit.com/1/user/-/" + currentActivity + "/date/" + date + "/"
+ date + ".json", options);
I would really appreciate it if you could help me in this regard.
 
Looking forward to hearing from you.
 
Thanks,
Josh
Best Answer
0 Votes

Hello,

please check https://wiki.fitbit.com/display/API/API-Get-Intraday-Time-Series

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Hello Ivan,

 

As I mentioned in my message, I have already checked this link but still I am getting error, I need to get intraday activity logs for steps count and distance, I would really appreciate it if you could help me.

 

Thanks,

Josh

Best Answer
0 Votes

In your post you mentioned you used link

https://wiki.fitbit.com/display/API/API-Get-Time-Series

which is different from what I sent:

https://wiki.fitbit.com/display/API/API-Get-Intraday-Time-Series

please confirm that you also checked the latest one.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes

Hi Ivan,

 

Thanks for your message. I had checked before this link but could not figured out how to fix the issue, however it is now resolved. I aslo found this link: http://www.diybiomechanics.com/2012/02/07/fitbit-lab/ which helped me in coding. Now, I can get minute level by using this URL: "http://api.fitbit.com/1/user/-/" + currentActivity + "/date/" + "2014-09-21/2014-09-21" + ".json"; I can also get 15minute level data via "2014-09-21/1d/15min/time/0:00/23:00", but if I want to get hour level, when I change the URL to this one: "2014-09-21/1d/60min/time/0:00/23:00" it doesn't work, could you please advise me in this regard?

 

Looking forward to hearing from you.

 

Thanks,

Josh

Best Answer
0 Votes

Hello Josh,

please read carefully through the link I posted above: https://wiki.fitbit.com/display/API/API-Get-Intraday-Time-Series - it has all information about intraday time series.

As it says in that wiki the only presicions that are supported are: 15 min and 1 min. No other presicions are currently supported.

Ivan Bahdanau
Senior Software Developer at Fitbit
Best Answer
0 Votes