04-08-2019 02:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-08-2019 02:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I just started to develop with Fitbit devices.
I want to post Alarm to my devices ,so I wrote a code.
Here is the code
import json
import requests
headers = {
"Authorization": "Bearer secret",
"content-type": "application/json"
}
payload={"time":"09:00-09:15","Enabled":'true',"recurring":True,"weekDays":"MONDAY"}
url = '<a href="https://api.fitbit.com/1/user/-/devices/tracker/example/alarms.json" target="_blank">https://api.fitbit.com/1/user/-/devices/tracker/example/alarms.json</a>'
r=requests.post(url,data=json.dumps(payload),headers=headers)
but it returns
{"errors":[{"errorType":"validation","fieldName":"recurring","message":"Recurring is required"},{"errorType":"validation","fieldName":"time","message":"Time is required"},{"errorType":"validation","fieldName":"enabled","message":"Enabled is required"}]}
I can't fix it.How do I to fix it?
04-12-2019 14:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



04-12-2019 14:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @takepan ,
I'm not that familiar with python. Here are a couple of things to consider
1. the "devices" scope should be enabled
2. you can add alarms for trackers, not smart watches (Ionic and Versa family)
3. check the case of the parameter name and the value. I think they should be all camel case.
The URL should look something like this
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

04-12-2019 17:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-12-2019 17:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It worked.Thanks.
But I have another question. How to specify multiple days of the week?

04-12-2019 17:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-12-2019 17:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sorry but it doesn't work. It returns 500 error.
{"errors":[{"errorType":"request","fieldName":"500","message":"An error occurred with the Fitbit Web API while processing the request. Error id: A29E072D:B50A_A92D87A6:01BB_5CB13337_4E1B7C7C:3E55"}],"success":false}
How do I fix it?

04-16-2019 18:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



04-16-2019 18:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
To enabled the alarm for multiple days, you need to do 2 things
1. parameter "recurring=true"
2. parameter "weekDays" list the days of the week in all capital letters separated by comma, no spaces.
Here's an example
We have this information documented here: https://dev.fitbit.com/build/reference/web-api/devices/#add-alarm
If you're still having a problem, please include the URL you are executing.
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

