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

How to use API

Hi,

 

I am trying to build an which can help people suffering from Diabetes.

For our application to work we need the data from your application and we need to integrate it with our system and analysis the results.

 

Can someone please guide me how can we do it.

 

Thanks,

Hitesh

Best Answer
0 Votes
20 REPLIES 20

I've shifted this to the dedicated web API forum where you'll probably have better luck getting an answer than in a generic tracker forum.

 

Good luck!

Mike | London, UK

Blaze, Surge, Charge 2, Charge, Flex 2 - iPad Air 2, Nokia Lumia 925 (Deceased), iPhone 6

Take a look at the Fitbit help site for further assistance and information.

Best Answer
0 Votes

What kind of platform are you aiming at? What coding language...lots of uknowns for who can help you here...

All starts with

https://dev.fitbit.com/docs/basics/

Best Answer
0 Votes
# You'll have to gather the tokens on your own, or use
# ./gather_keys_oauth2.py
authd_client = fitbit.Fitbit('<consumer_key>', '<consumer_secret>', oauth2=True,
                             access_token='<access_token>', refresh_token='<refresh_token>')
authd_client.sleep()

Dear administrator. where I can find the Access_token and refresh token? 

Best Answer
0 Votes

chw33,

 

You can get the access tokens and refresh tokens using the script ./gather_keys_oauth2.py within the python-fitbit folder.

 

You can get access to the python library using this link.

Best Answer
0 Votes

I download it and implement it on the linux server. but the problem is I can not find 

access_token
refresh_token
Best Answer
0 Votes

run this python script for those keys

Best Answer
0 Votes

 

How do I do it?

 

Have a great day and Thanks and Best wishes

undefined

Best Answer
0 Votes

[19/Jan/2016:10:39:31] ENGINE Started monitor thread '_TimeoutMonitor'.
[19/Jan/2016:10:39:31] ENGINE Started monitor thread 'Autoreloader'.
[19/Jan/2016:10:39:36] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x1a1e990>>
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 205, in publish
output.append(listener(*args, **kwargs))
File "/usr/lib/python2.6/site-packages/cherrypy/_cpserver.py", line 168, in start
ServerAdapter.start(self)
File "/usr/lib/python2.6/site-packages/cherrypy/process/servers.py", line 170, in start
wait_for_free_port(*self.bind_addr)
File "/usr/lib/python2.6/site-packages/cherrypy/process/servers.py", line 439, in wait_for_free_port
raise IOError("Port %r not free on %r" % (port, host))
IOError: Port 8080 not free on '127.0.0.1'

[19/Jan/2016:10:39:36] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 243, in start
self.publish('start')
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 223, in publish
raise exc
ChannelFailures: IOError("Port 8080 not free on '127.0.0.1'",)

[19/Jan/2016:10:39:36] ENGINE Bus STOPPING
[19/Jan/2016:10:39:36] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) already shut down
[19/Jan/2016:10:39:36] ENGINE Stopped thread '_TimeoutMonitor'.
[19/Jan/2016:10:39:36] ENGINE Stopped thread 'Autoreloader'.
[19/Jan/2016:10:39:36] ENGINE Bus STOPPED
[19/Jan/2016:10:39:36] ENGINE Bus EXITING
[19/Jan/2016:10:39:36] ENGINE Bus EXITED
[root@localhost fitbit]# vi /etc/sysconfig/iptables

Best Answer
0 Votes

Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 243, in start
self.publish('start')
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 223, in publish
raise exc
ChannelFailures: IOError("Port 8080 not free on '127.0.0.1'",)

[19/Jan/2016:10:52:07] ENGINE Bus STOPPING
[19/Jan/2016:10:52:07] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) already shut down
[19/Jan/2016:10:52:07] ENGINE Stopped thread '_TimeoutMonitor'.
[19/Jan/2016:10:52:07] ENGINE Stopped thread 'Autoreloader'.
[19/Jan/2016:10:52:07] ENGINE Bus STOPPED
[19/Jan/2016:10:52:07] ENGINE Bus EXITING
[19/Jan/2016:10:52:07] ENGINE Bus EXITED
[root@localhost fitbit]# ^C
[root@localhost fitbit]# netstat -pnl | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 23749/python
[root@localhost fitbit]#

Best Answer
0 Votes

19/Jan/2016:11:12:14] ENGINE Started monitor thread '_TimeoutMonitor'.
[19/Jan/2016:11:12:14] ENGINE Started monitor thread 'Autoreloader'.
[19/Jan/2016:11:12:19] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x2a9a990>>
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 205, in publish
output.append(listener(*args, **kwargs))
File "/usr/lib/python2.6/site-packages/cherrypy/_cpserver.py", line 168, in start
ServerAdapter.start(self)
File "/usr/lib/python2.6/site-packages/cherrypy/process/servers.py", line 170, in start
wait_for_free_port(*self.bind_addr)
File "/usr/lib/python2.6/site-packages/cherrypy/process/servers.py", line 439, in wait_for_free_port
raise IOError("Port %r not free on %r" % (port, host))
IOError: Port 8080 not free on '127.0.0.1'

[19/Jan/2016:11:12:19] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 243, in start
self.publish('start')
File "/usr/lib/python2.6/site-packages/cherrypy/process/wspbus.py", line 223, in publish
raise exc
ChannelFailures: IOError("Port 8080 not free on '127.0.0.1'",)

[19/Jan/2016:11:12:19] ENGINE Bus STOPPING
[19/Jan/2016:11:12:19] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) already shut down
[19/Jan/2016:11:12:19] ENGINE Stopped thread '_TimeoutMonitor'.
[19/Jan/2016:11:12:19] ENGINE Stopped thread 'Autoreloader'.
[19/Jan/2016:11:12:19] ENGINE Bus STOPPED
[19/Jan/2016:11:12:19] ENGINE Bus EXITING
[19/Jan/2016:11:12:19] ENGINE Bus EXITED
[root@localhost fitbit]#

Best Answer
0 Votes

 Firstly you need to change your redirect URL to http://127.0.0.1:8080/

 

Next The script needs to be run the script with the following parameters.

./gather_keys_oauth2.py <OAuth 2.0 Client ID> <Client Secret>

 

Substituting the client ID and client secret for your values.

Best Answer

Firstly you need to change your redirect URL to http://127.0.0.1:8080/

 

you mean call back URL?

 

Have a great day and Thanks

Best Answer
0 Votes

That's correct.

Best Answer
0 Votes

 

 

 

success how to get my data from the CSV?undefined

Best Answer
0 Votes

Traceback (most recent call last):
File "download.py", line 108, in <module>
get_data()
File "download.py", line 56, in get_data
(consumer_key, consumer_secret, oakeys) = fitbit_key()
File "/root/fitbit/fitbitsource/keys.py", line 16, in fitbit_key
consumer_key = os.environ['FITBIT_CONSUMER_KEY']
File "/usr/lib64/python2.6/UserDict.py", line 22, in __getitem__
raise KeyError(key)
KeyError: 'FITBIT_CONSUMER_KEY'

Best Answer
0 Votes

undefined

how do I do authorization header?

 

Best Answer
0 Votes

Hi @chw333, I'd suggest reviewing the documentation on the authorization process if you haven't already. You can find it here

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hi @elderofozone , I am trying to get the access token and refresh token and ran 

python-fitbit/gather_keys_oauth2.py <OAuth 2.0 Client ID> <Client Secret>

 

But I am also getting the same error mentioned in @chw333's question as below

 

ChannelFailures: IOError("Port 8080 not free on '127.0.0.1'",)

 

[19/Jan/2021:23:55:33] ENGINE Bus STOPPING

[19/Jan/2021:23:55:33] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) already shut down

[19/Jan/2021:23:55:33] ENGINE Stopped thread '_TimeoutMonitor'.

[19/Jan/2021:23:55:33] ENGINE Stopped thread 'Autoreloader'.

[19/Jan/2021:23:55:33] ENGINE Bus STOPPED

[19/Jan/2021:23:55:33] ENGINE Bus EXITING

[19/Jan/2021:23:55:33] ENGINE Bus EXITED

 

I have checked the redirect URL(call back url) and it is set as http://127.0.0.1:8080/

Could you help me with this problem?

 

Thank you!

Best Answer
0 Votes
Woah, this is a blast from the past.



Sorry I do not remember jung123 post nor the specific error. Seems as though
you already have something running on port 8080. Try 8081?
Best Answer