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

How to convert GET string to URL string

ANSWERED

Hi,

 

I am trying to build an iOS app that uses the FitBit API.  I understand I can use OAuth as per the guidance in http://stackoverflow.com/questions/14036210/ios-http-request-example.  Two questions:

 

1.  How can I convert GET /1/user/-/activities/date/2010-04-02.json HTTP/1.1 into an https URL string?

2.  How do I get the right user ID for a user of my app?  Is it just the same FitBit ID that a FitBit user uses when the register to use FitBit?

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@michaelnares wrote:

So as long as the user is logged in on the browser on the phone, it should work?


No. If you send a valid oauth access_token in the header of the API request it will work.

 

https://wiki.fitbit.com/display/API/API+Explorer

 

Read this page very several times: https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API

 

I know you don't want to read the page above, but reading it and fully understanding it first will save you a lot of time.

 

Search Google for ios oAuth and FitBit tutorial or something for a step-by-step tutorial. 

 

 

 

 

 

 

View best answer in original post

Best Answer
0 Votes
4 REPLIES 4

@michaelnares wrote:

Hi,

 

I am trying to build an iOS app that uses the FitBit API.  I understand I can use OAuth as per the guidance in http://stackoverflow.com/questions/14036210/ios-http-request-example.  Two questions:

 

1.  How can I convert GET /1/user/-/activities/date/2010-04-02.json HTTP/1.1 into an https URL string?

2.  How do I get the right user ID for a user of my app?  Is it just the same FitBit ID that a FitBit user uses when the register to use FitBit?

 


It would just be https://api.fitbit.com/1/user/-/activities/date/2010-04-02.json

 

Rather than passing in the user you would leave the dash so that it requests the current logged-in user. 

 

You might want to look into this service which aims to simplify connecting to APIs: http://live.temboo.com/library/Library/Fitbit/

 

 

Best Answer
0 Votes

So as long as the user is logged in on the browser on the phone, it should work?

Best Answer
0 Votes

@michaelnares wrote:

So as long as the user is logged in on the browser on the phone, it should work?


No. If you send a valid oauth access_token in the header of the API request it will work.

 

https://wiki.fitbit.com/display/API/API+Explorer

 

Read this page very several times: https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API

 

I know you don't want to read the page above, but reading it and fully understanding it first will save you a lot of time.

 

Search Google for ios oAuth and FitBit tutorial or something for a step-by-step tutorial. 

 

 

 

 

 

 

Best Answer
0 Votes

Really helpful, many thanks.

Best Answer
0 Votes