i need to get data from Fitbit API with US unit measure my code has fix value in en_US but i receive Kilogram
it doesn't Pound.
private RestRequest CreateRestRequest(string apiCall, Method method = Method.GET)
{
var request = new RestRequest(apiCall, method);
// Always no cache
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept-Language", "en_US");
return request;
}is these correct for add information on header ?
ps . My profile changed to 'Pound' when i scale on Aria.
Thank you. 🙂
Answered! Go to the Best Answer.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
What exactAPI endpoint are you calling. I just tested https://api.fitbit.com/1/user/-/body/log/weight/date/<date>.json and it worked for me with Accept-Language: en_US header it responded in pounds.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
What exactAPI endpoint are you calling. I just tested https://api.fitbit.com/1/user/-/body/log/weight/date/<date>.json and it worked for me with Accept-Language: en_US header it responded in pounds.
Best Answeri called 'API-Get-Time-Series' and respect type '[/body/weight]'.Before i call API i prepare request object like these. (below)
var request = CreateRestRequest(requestUrl);
request.AddHeader("Accept-Language", "en_US");
request.OnBeforeDeserialization = resp =>
{
// Set root element
var data = (JsonObject) SimpleJson.DeserializeObject(resp.Content);
if (data != null && data.Any())
{
var root = data.FirstOrDefault();
request.RootElement = root.Key;
}
};
Best Answer