I have downloaded the sample app and got it running but can go no further. The documentation kind of tells what needs to be done, but very little on how to do it. There are many questions but I will start with these. So how does my application make an http request and send a special authorization header? Also what part of the sample app code is considered the library that I would need to include in my application? Where do I find the OAuth 1.0a library for my preferred language and framework? How do I create a user authorization flow to obtain user consent?
Thanks in advance for any light you can shed on this very complicated process.
I spent the last 1 hour to write a code, i wrote 2 version. Here is one, but i cant test it:
var request = (HttpWebRequest)WebRequest.Create("https://api.fitbit.com/1/user/" + encoded_userid + "/body/log/weight.json");
var postData = "weight=100.0";
postData += "&date=2015-09-09";
var _data = Encoding.ASCII.GetBytes(postData);
request.Headers["Authorization"] = "Bearer " + accesmodell.access_token;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "application/json";
request.ContentLength = _data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(_data, 0, _data.Length);
}
var _response = (HttpWebResponse)request.GetResponse();[i'm the same user, just on another test account :P]
Best AnswerWow!!! I can't thank you enough. It worked. I had tried variations of this exact same code so many times with no success. It apparently comes down to the specific combination of encoding type, content type, and accept that the fitbit API requires. It is beyond my comprehension as to why this is not included in the documentation. It would save weeks of work trying to hit this exact combination. Thanks again for taking the time to help me.
Best AnswerNo problem, we will use this code later 🙂
Best Answers i kind of an older thread. The new guidlines for FitBit are to use a Chrome Cutom Tabs for the "WebView." Is this taken care of using this plug in?
Best Answers i kind of an older thread. The new guidlines for FitBit are to use a Chrome Custom Tabs for the "WebView." Is this taken care of using this plug in?
Best Answer