05-09-2019 08:23
05-09-2019 08:23
Dear Reader,
so I managed to get the OAuth2 "Handshake". No I am facing
problems with the API Calls.
string apiCall = ToFullUrl("/1/user/{0}/profile.json", ClientId);
// apiCall looks like https://api.fitbit.com/1/user/{ClientId}/profile.json"
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiCall);
request.Method = "GET";
request.Headers["Authorization"] = "Bearer " + accesToken;
request.Accept = "application/json";
myResponse = request.GetResponse();
after that call it throws a 403 Exception altough I do have all the permissions which I Require for that
call. (For debugging purposes I ll ask for every scope)
Has anybody corrections or tipps how I should proceed?
Thanks for your help
Answered! Go to the Best Answer.
05-09-2019 16:28
05-09-2019 16:28
Hi @DeniOcean
I'm glad you got the API call to work. Using a hyphen (-), we are pulling the userId from the access token. You should be able to specify either the Fitbit UserID with the Get Profile endpoint. The API call would look something like this
https://api.fitbit.com/1/user/ABC123/profile.json
If you would like me to help debug why specifying the userId isn't working, please private message me your client ID and the user ID in the Get Profile endpoint.
Gordon
05-09-2019 10:51
05-09-2019 10:51
After a few tries I figured out that the http request does not need the userId
"/1/user/{user-id}/profile.json" I mentionned above. You HAVE to make a dash [-] as user-id.
Well that kind of means that the fitbit Api recognises the User by their Token am I Right?
05-09-2019 16:28
05-09-2019 16:28
Hi @DeniOcean
I'm glad you got the API call to work. Using a hyphen (-), we are pulling the userId from the access token. You should be able to specify either the Fitbit UserID with the Get Profile endpoint. The API call would look something like this
https://api.fitbit.com/1/user/ABC123/profile.json
If you would like me to help debug why specifying the userId isn't working, please private message me your client ID and the user ID in the Get Profile endpoint.
Gordon