04-15-2015 15:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-15-2015 15:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I have been using a Google Apps script in a Google Spreadsheet to download minute by minute data. Today I tried to download data for my account and I got "We're sorry, a server error occurred. Please wait a bit and try again" at the top of the spreadsheet. Did something change in the API that might be causing this? It might be something with Google, have no idea how to debug it.
I have another spreadsheet that doesn't do the intraday stuff that's working fine.
This script was based off of things I found online
Here it is https://jsfiddle.net/j72qbe08/
07-16-2015 10:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 10:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Did it but can't finish as I must go out now. I got BEYOND Authorize!!! I used the OAuth 2. ID as the Consumer Key!
Will post later when I complete! I'm SOOOOOO HAPPY!
THANK YOU, THANK YOU......THANK YOU!!!

07-16-2015 11:12 - edited 07-16-2015 11:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 11:12 - edited 07-16-2015 11:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Yea, you have to copy the entire contents of the file interday.gs into a blank script editor. It might look similar to the original one, but it is significantly different. That's the whole point.
Sounds like you're on the right track now, you just need to put the right keys into the Set up window now, including the project key. No need to share the sheet anymore.

07-16-2015 12:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 12:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I see my problem now. I revoked access to the app on my fitbit setting so that I could start all over again. I obviously shouldn't have done this. Now I don't know which application it was and how to get it back. Any suggestions?
I'm sooooo close!

07-16-2015 13:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 13:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Here is what is written in the red warning banner: Access not granted or expired. (line 306, file ""). I hope you can understand this more than I can!

07-16-2015 16:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 16:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Me again....I've tried restarting my computer, logging out of fitbit and trying to authorize the apps script application but am still met with:
The app you're trying to connect did not provide valid information to Fitbit. Please report this issue to them.
Developer information: invalid_request - Invalid redirect_uri parameter value
It would be greatly appreciated if I could find out how to reinstate the fitbit application I revoked this morning in my attempt to start all over again with a clean slate.
You have to give me 'A' for effort as I'm still at it, several days now!

07-16-2015 20:07 - edited 07-16-2015 20:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 20:07 - edited 07-16-2015 20:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
As it says, your redirect url is wrong. Either you put it incorrectly into the Fitbit app settings, didn't put one at all, or the project key is incorrect. If you make a new spreadsheet, there's a new project key, and you have to update the redirect url
the thing that goes (but you replace "PROJECT KEY")
https://script.google.com/macros/d/{PROJECT KEY}/usercallback

07-16-2015 20:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 20:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've done it correctly.
This is my Project Key
Project key | MckphAP-zRbzcw1M7KjOhTKAZcoUUyC-k |
And this is what I added to the Callback URL:
https://script.google.com/macros/d/{MckphAP-zRbzcw1M7KjOhTKAZcoUUyC-k}/usercallback
Should I start all over again to try a new one?

07-16-2015 20:33 - edited 07-16-2015 20:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 20:33 - edited 07-16-2015 20:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
cf my instructions:
"(Make sure to replace {PROJECT_KEY} with the project key you got from step 3)."
You aren't supposed to include the {} braces

07-16-2015 20:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-16-2015 20:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
YEAH!!!!!!!! Thank you so much for your patience! I told you I wasn't a techie! I'm just a senior trying to make my fitbit work for me!!
Thanks again! What do I know about brackets? Obviously NOTHING!! hahahaha!

07-18-2015 01:45 - edited 07-18-2015 01:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-18-2015 01:45 - edited 07-18-2015 01:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you very much, got it working even it's a bit "confusing" my data and formulas because of its "upside down" nature. For me it would be easier a sort of "append the last day" format.
I suppose it's something around lines 226->347, but I am so noob 😄
I'll work around it, I hope 😄
Thank you again 😄

07-19-2015 16:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-19-2015 16:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Simon, thank you for this script!
I was able to download my intraday step data. Woo hoo!
Are you planning on adding the intraday heart rate data to the script? That would make the script even more wonderful.
Thank again,
Gina

07-19-2015 22:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-19-2015 22:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Wasn't planning on it, but it wouldn't be very complicated.
Information on the API for that here:
https://wiki.fitbit.com/display/API/API-Get-Intraday-Time-Series
07-20-2015 02:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2015 02:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Again, thank you 🙂

07-22-2015 12:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2015 12:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@sshi- Even if you we're planning on it, any chance you want to help out your fellow fitbit community members with less technical accumen? Your script works wonderfully with intraday steps data and I know a lot of us would appreciate it. I've tried for hours to modify your script to get intraday heartrate data to work but keep ending up with the dreaded "dataset" from "undefined" error.
07-22-2015 12:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2015 12:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Has anyone been successful in getting heart data with this? Everything I've tried just returns an error "TypeError: Cannot call method "getContentText" of undefined."
I have changed the "activities" variable to "activities/heart" and "activities/log/heart," and tried similar combos for the "intradays" variable. I have also changed URLFetchApp to be specific dates instead of including variables, used the exact same URL in the example from the page sshi linked, used date and time ranges where I had initiated a workout (so I know second by second data was being sent to my profile), etc.
Wouldn't that error suggest the script is pulling zero data from my profile?
07-22-2015 14:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-22-2015 14:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I have also tried similar things without success. It seems that although it's in the documentation, they still may not have made these endpoints accessible thorugh the API.
07-23-2015 09:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2015 09:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@JeremiahFitbit Hey Jeremiah - Any thoughts on the problem we are having? Have partner level api access, using Oauth 2, and can pull intraday step data but calling for intraday heartrate data isn't returning anything. We've all tried using the function calls shown on the get-intraday-time-series endpoint documentation page - works for the intraday step data but striking out on the intraday heart rate data.
07-23-2015 10:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



07-23-2015 10:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@mattolomew: I can only say that the Fitbit API is working properly. I'm not an expert in Google Sheets. You'll have to ask its creator.

07-23-2015 11:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2015 11:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@mattolomew I coulnd't find API for the resting heart rate from fitbit API docs. I am looking for something to give me just one value per day, such as "activities/log/floors" or "sleep/minutesAsleep". What is the command for that? I assume something like "activities/log/heart"? That didn't work though. Thanks for your help.
Abbas

07-23-2015 12:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2015 12:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thank you to everyone--especially @sshi--for trying to work this out. I don't have the skills to create a script myself, and I appreciate all the efforts to get this to work.
That said, the detailed heart rate data should be provided by FitBit as a one-click download for device users. The HR data was the primary reason I bought my Charge HR two weeks ago, and, since I can't download the data, I am returning the device to Amazon.
Thanks again!
Gina
