01-27-2015 02:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-27-2015 02:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

- Labels:
-
.NET
-
OAuth 1.0a
Accepted Solutions
01-27-2015 11:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-27-2015 11:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.
Senior Software Developer at Fitbit

01-27-2015 11:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-27-2015 11:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.
Senior Software Developer at Fitbit

01-27-2015 18:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-27-2015 18:30
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
i 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; } };

01-27-2015 18:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-27-2015 18:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
i found my problem. Thank you for answer 🙂
the problem is 'wrong step of add header'.

