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

How do I export all my TCX files (GPS data of tracked walks)?

I have a number of runs and walks that I tracked with the GPS of my phone. I can view these maps in the IOS app, and export the GPS data for an individual map as a TCX file.

I would like the full set of TCX files for all my exercises from the last 10 years and I ran a full data export assuming these would be included in the export, but they are not. The export files do contain links to the TCX files on the Fitbit web dashboard, but these don't work because the web dashboard has now been decommissioned. The links just redirect to the "we've killed the web dashboard page".

Specifically

  • I have an export file exercise-400.json
  • This file includes 100s of entries for activities Fitbit auto detected ("logType" : "aut_detected)", and a few entries for the activities I manually tracked in the IOS app ("logType" : "mobile_run").
  • The "mobile_run" entries do contain a link to the TCX file on the web dashboard
     "tcxLink" : "https://www.fitbit.com/activities/exercise/<ID>?export=tcx"
  • However this link now just displays the "Find your health dashboard in the Fitbit app" text.

If those export links worked I would be happy using a text editor and "find" to manually copy them from the exports files, but of course they don't work now the dashboard has gone.

I also would not mind having to manually export them individually from the app if there was a quick way of locating them in app such as jumping to specific dates, or seeing a list of all my exercises in the app like there was in the web dashboard. But there is not an easy way of doing this, I have to manually step through 10 years of exercises to spot the ones with a map icon. I've logged a feedback request on this subject but I doubt anything will happen. https://community.fitbit.com/t5/Product-Feedback/Add-filter-to-show-manually-tracked-exercises-activ...

https://support.google.com/fitbit/answer/14236615?hl=en is the help on exports which is ambiguous.

https://community.fitbit.com/t5/Web-API-Development/Is-there-a-script-to-fetch-all-Activity-TCX-file... is post that talks about using the api to get these, but I am not sure they would work if it uses the same export link above.

 

Best Answer
0 Votes
10 REPLIES 10

Hello @Hugh1234 I've moved your post to the API, 

Someone may be able to help. 

The other way is to download your history 

Either way it can not be done through the app. 

Best Answer
0 Votes

Hi Rich,

Where are the GPS files in the export? As noted above, when I tried this the only thing I could find were links to the TCX files on the web dashboard, which no longer work because the web dashboard no longer exists. I could not see any TCX, GPX, or KML files in the export itself. 

What I did was

  1. Export my data.
  2. Download and unzip.
  3. Open each of the exercise-n.json files. 
  4. Locate entries with "logType" : "mobile_run" and "hasGps" : true.
  5. Copy the TCX file link from "tcxLink" : "https://www.fitbit.com/activities/exercise/[id]?export=tcx"
  6. Click on the link, login, get a page saying “web dashboard no longer supported” instead of a TCX file.

That was the only GPS related info I could find in the export. I was surprised because I was expecting to see a folder of KML/GPX/TCX files or similar. Did it used to contain GPS files in the export, not just links back to the dashboard? Or am I just missing them in my export?

Thanks

Best Answer
0 Votes

Can you code? If so, just use these two requests

To list out all your actvitiies:

https://dev.fitbit.com/build/reference/web-api/activity/get-activity-log-list/#Request

To get the TCX files:

https://dev.fitbit.com/build/reference/web-api/activity/get-activity-tcx/#Request

You don't even need to register for an app, you can re-use the auth token in the now defunct web dashboard. 

Let me know if you can't code but are willing to try, I can help you out.

Best Answer

 


@ryantam626 wrote:

Can you code? If so, just use these two requests

To list out all your actvitiies:

https://dev.fitbit.com/build/reference/web-api/activity/get-activity-log-list/#Request

To get the TCX files:

https://dev.fitbit.com/build/reference/web-api/activity/get-activity-tcx/#Request

You don't even need to register for an app, you can re-use the auth token in the now defunct web dashboard. 

Let me know if you can't code but are willing to try, I can help you out.



Thanks, that's interesting. I am a bit rusty but I can code so I will look into that for the future.

I had a quick go but I am not sure what you mean by, "You don't even need to register for an app, you can re-use the auth token in the now defunct web dashboard"? 

I tried the curl example below using the OAUTH token from my cookies when logged into the fitbit.com dashboard as the access token, but as expected it did not like that and returned "invalid token; Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.". I will visit that link, but I just wanted to check what your work around was before I relive the joy that is OAUTH2

curl -X GET "https://api.fitbit.com/1/user/-/activities/list.json?afterDate=[redacted]&sort=asc&offset=0&limit=2 " \
-H "accept: application/json" \
-H "authorization: Bearer <access_token>"

It's not urgent as in the end I manually exported a selection of TCX files in the app using the dates from the export JSON files. It was very tedious, but at least I could skip the weeks I knew did not have TCX files based on the export file.

Best Answer
0 Votes

Oh that's weird. 

What I did:

1. Head to https://www.fitbit.com/dashboard 

2. Login if needed

3. Open up devtools

4. Open up network tab

5. Click dashboard (top left) again

6. Inspect any of the profile.json XHR request

7. Copy the `Authorization` request header

```bash

 curl -X GET "https://api.fitbit.com/1/user/<remember-to-fill-this-in>/activities/list.json?afterDate=<some-date>&offset=0&limit=100&sort=asc" -H "accept: application/json" -H "authorization: <the-entire-auth-header-value-as-you-have-done>"

```

works for me.

I think what you were missing is just filling out your user ID, which you can easily find in the profile.json XHR request.

Best Answer

Hi @Hugh1234 

There are a couple of ways to do this

  1. You can use Fitbit Web API Explorer to call Get Activity Log List endpoint to get the activity log ID, then call Get Activity TCX to get the GPS points.   If you know how to program an application, you can automate this process using the Web API endpoints in a java, javascript, python, etc application.   
  2. See "How do I export my Fitbit data?" and look at the section called How do I export my Fitbit GPS data?
  3. Go to account.google.com and log into your account.  Select "Data & Privacy" from the left side menu.  Scroll down until you see "Fitbit data and privacy", and select Manage your Fitbit data and privacy.  Choose the Export your data button, then follow the instruction to download your data.   However, I do believe this will provide you with the GPS data.

Best,

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi Gordon,

> 3. Go to account.google.com and log into your account.  Select "Data & Privacy" from the left side menu.  Scroll down until you see "Fitbit data and privacy", and select Manage your Fitbit data and privacy.  Choose the Export your data button, then follow the instruction to download your data.   However, I do believe this will provide you with the GPS data.

I'd already done an export before posting this. The issue I have is that the only GPS info I have been able to find in the export are links to the TCX files on the web dashboard which no longer work as the dashboard has been killed, e.g., entries like this (where ID is the activity ID):

 "tcxLink" : "https://www.fitbit.com/activities/exercise/<ID>?export=tcx"

Are you able to confirm with the developers whether the export file is supposed to contain the TCX or similar files, and if so, where are they? Or are the broken links all that is supposed to be included in the export? I assume these links would have worked before July.

Thanks

Best Answer

Thanks, that worked, and I was able to grab the activities from the API.

Interestingly I see the TCX links are almost the same as the ones in the export file, which I guess should not be a surprise.

   "tcxLink": "https://api.fitbit.com/1.1/user/-/activities/<ID>.tcx",

vs 

 "tcxLink" : "https://www.fitbit.com/activities/exercise/<ID>?export=tcx"

 I'm struggling to get the full TCX file from the API, but I think that may be an issue with MSDOS curl because I am getting an XML response from the API but then it throws a curl error. I'll try it in a Linux VM later.

Thanks. That's something I can play around with.

Best Answer
0 Votes

Also wondering if there is a way to use the tcxLink to actually download the tcx files?

Otherwise I would love to try the coding method, but I need some more detailed instructions if anybody can help.

Disappointing there isn't an easier way to download all my tcx files.

Best Answer
0 Votes

 

 

   "tcxLink": "https://api.fitbit.com/1.1/user/-/activities/<ID>.tcx",

 

I've tried to use this format to download my tcx, I can get the tcx IDs from the exercise.json files when I download my data. Bit of a long and frustrating process extracting them, but I can do that.

But when I try and download them using this format, I get this error:

 

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }
}

 

Can I just check I'm formatting the link correctly? I'm using:

 

https://api.fitbit.com/1.1/user/8OXDL4/activities/331022619.tcx

 

With that user string appearing after https://web-api.fitbit.com/1/user/ in profile.json when I go to the fitbit dashboard (I did change it). Obviously I'm logged into the dashboard when I try this, too.

Best Answer
0 Votes