08-25-2015 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-25-2015 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've been reading the docs over at https://dev.fitbit.com/docs/devices/ and using the library available at https://github.com/whazzmaster/fitgem.
I'm trying to set an alarm for "13:00-04:00"
The response I get back is:
301 Net::HTTPMovedPermanently server: nginx x-ua-compatible: IE=edge,chrome=1 location: http://api.fitbit.com/1/user/-/devices/tracker/alarms.json connection: close, close content-length: 0 date: Tue, 25 Aug 2015 15:56:56 GMT x-frame-options: SAMEORIGIN
The odd thing here I find is that the redirected URL does NOT have a tracker ID in it
My post body:
{ "enabled": "true", "time": "14:00-04:00", "recurring": "false", "weekDays": [ ] }
For the booleans, I've tried both "true" and true.
Modified from the original API:
def add_alarm(opts) device_id = opts[:device_id] post("/1/user/#{@user_id}/devices/tracker/#{device_id}/alarms.json", opts) end

- Labels:
-
OAuth 1.0a
08-25-2015 11:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-25-2015 11:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
You need to use HTTPS. https://api.fitbit.com

08-25-2015 11:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-25-2015 11:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
From what I can tell, I am using HTTPS:
def consumer @consumer ||= OAuth::Consumer.new(@consumer_key, @consumer_secret, { :site => 'https://api.fitbit.com', :authorize_url => 'https://www.fitbit.com/oauth/authorize', :proxy => @proxy }) end def access_token @access_token ||= OAuth::AccessToken.new(consumer, @token, @secret) end
The request is made using the access_token. If I understand everything here, my requests are being made over HTTPS.
I'm starting to feel like I need to reimplement the entire library and start with OAuth, but I wanted to see if this is a quick fix first before I do that.

