01-06-2023 14:08
01-06-2023 14:08
I'm able to successfully pull in activity intraday data, HR intraday data, etc, but when I modify that code to pull the AZM data, I keep getting this 403 error:
{"errors":[{"errorType":"insufficient_permissions","fieldName":"n/a","message":"API client is not authorized by Fitbit to access the resource requested."}]}
I'm using the URL HTTP request format specified here for activity and here for AZM. I am providing my token for configuration, I've tried hardcoding my user ID and just leaving it as the '-' (as shown in the examples in documentation), calling by date and interval, etc. I also have enabled access to the 'activity' scope which AZM falls under.
Anyone have any ideas on what could be causing this?
01-09-2023 09:17
01-09-2023 09:17
Hi @choxner
If you are able to get intraday for activity but not AZM, it's likely you have a typo somewhere. Would you please provide the endpoint syntax or code that builds the endpoint that you're trying to execute? I'll provide another set of eyes for you.
01-12-2023 19:53
01-12-2023 19:53
Much appreciated!
Code is in R and I am on personal mode.
For some reason I was not allowed to post the dates with actual dashes, so I replaced those with (dash).
base_url = "https://api.fitbit.com/1/user/-/activities/"
date = "2022(dash)12(dash)20"
resource_path = "active-zone-minutes" # or 'steps', 'calories', etc
detail_level = "5min"
intraday_url = paste0(base_url, sprintf("%s/date/%s/1d/%s.json", resource_path, date, detail_level))
date_url = paste0(base_url, sprintf("%s/date/%s/1d.json", resource_path, date))
output = get(intraday_url, token) # sends HTTP request
Here's the endpoint this would create the following:
https://api.fitbit.com/1/user/-/activities/active-zone-minutes/date/2022(dash)12(dash)20/1d/1min.json
This works for activities intraday and time series. It works for AZM time series. It does not work for AZM intraday.
01-12-2023 20:17
01-12-2023 20:17
Would you provide the endpoint syntax you used for active zone minutes intraday data along with the HTTP Status code and error message you received?
01-13-2023 15:39
01-13-2023 15:39
Endpoint:
https://api.fitbit.com/1/user/-/activities/active-zone-minutes/date/2022(dash)12(dash)20/1d/1min.json
Error:
{"errors":[{"errorType":"insufficient_permissions","fieldName":"n/a","message":"API client is not authorized by Fitbit to access the resource requested."}]}
01-17-2023 06:50
01-17-2023 06:50
Hi @choxner
If you're providing "(dash)" in the endpoint syntax, that is incorrect and is likely causing the error. You should be sending us is
https://api.fitbit.com/1/user/-/activities/active-zone-minutes/date/2022-12-20/1d/1min.json
This is the correct syntax for the Active Zone Minutes intraday endpoint. If you're still getting the 403 error, double check that the application type in your dev.fitbit.com/apps setting is configured for "personal", and you're generating an access token for the user that owns the application.
01-17-2023 21:15
01-17-2023 21:15
I am using "-" instead of "(dash)". As stated in my previous post, the forum blocked me from including the date with actual dashes.
My application is set to personal, and I am able to access intraday data for other categories. My token is created for my own user, which is the owner of the application.
01-18-2023 08:12
01-18-2023 08:12
Hi @choxner
I'm going to send you a private message and request some information from you.
Gordon
01-18-2023 11:17
01-18-2023 11:17
Hi @choxner
I believe I found the problem that you discovered and I'm going to report it to engineering to confirm. I'll let you know what I find out.
Gordon