Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

documentation not up to date

Hi all,

first forgive me if my statement here are wrong as I do believe as a developer that if there is a  problem first of all it is my fault 🙂

I am concerned about the level of accuracy of the Fitbit API documentation;for example...

I am trying to get the list of activities from  

https://api.fitbit.com/1/user/-/activities/list.json

I found few discrepancies:

  1. the doc say that one of the URL parameter is "user-id" but in the URL is passed as "user"
  2. the request header does not specify that  the Authorisation parameter - Bearer- is needed
  3. the JSON in the example does not reflect the JSON returned by the end-point
  4. the JSON returned by the end-point has  a  "minSpeedMPH" as int when it is a double

it is me doing something wrong or not properly interpreting the documentation or it need an update?

Thanks.

Best Answer
0 Votes
4 REPLIES 4

@brillox I'll try to address these as best as I can. Robot Happy

 

  1. True, it's not a parameter but it is part of the resource URL.
  2. The "Request Headers" sections usually list the optional headers, "Authorization: Bearer {token}" is required for making requests.
  3. Could you explain this a bit further? The only two things I noticed being different was that my response shows two values that aren't in the example: "originalDuration" and "originalStartTime".
  4. Where does it say it's an integer?
Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hi @AndrewFitbit ,

many thanks for your reply.

  1. "it is part of the resource URL." sorry I do not get this.
  2. Thanks I read that now.
  3. I copied the JSON in the example and pasted into http://jsonutils.com/ I then created the c# class and when getting the response back from the endpoint the JSON string is populated with activities and pagination but the de-serialised object is null. So... I copied the returned  response JSON string rather than the JSON response from the documentation class back into  http://jsonutils.com/ and pasted the c# classes and run my code again; at this point I got duplicated classes - the ones generated by http://jsonutils.com/- and precisely "ActivityLevel" and  "Activity"; the activityLevel class has two "minSpeedMPH" properties: one is an int and one a double but I did not noticed that when i run the code. I then deleted the duplicated classes and tun the code against the newly generated c# classes. I am not going to paste the whole JSON string here but you can easily replicate yourself; otherwise I am happy to send you more code via a private email if you want. So.. back to the story... I run in debug mode and I got a warning saying that  minSpeedMPH is a double not an int. In total honesty as I am writing this reply I tried again and I did not get this warning about minSpeedMPH and I found out why: because jsonutils created duplicated classes for ActivityLevel" and  "Activity" yesterday I deleted the "ActivityLevel" class that has 2 "minSpeedMPH": one as int and one as double whereas the other "ActivityLevel"  class generated has only 1 "minSpeedMPH" as int.
    My question is why jsonutils generated duplicated classes from the response JSON string? Because of a bug in their code or because of malformed JSON in the response? 

apologies for the length of the reply;  I tried to be as precise as I could. 

Best Answer
0 Votes

@brillox

 

1. Example of a resource URL:

https://api.fitbit.com/1/user/-/activities/list.json

so user-id is "passed in the url" as you say, because URL parameters would be anything after ".json".

 

3. We don't really debug code, but if there's something in regard to Fitbit's Web API then we can certainly help you out. I don't think the json response is malformed so I'm not sure why duplicate classes would be generated.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

OK  @AndrewFitbit no problem; the duplicate classes are easy to spot and to delete; then if anyone delete by mistake the class that does not have teh minSpeedMPH as double it is not a big issue because in the remaining class it is easy to change an int to a double. If you say that the json response is not malformed I do not have any reason for not believing you.

Thank you for answering me.

Massimo

Best Answer