Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload does not support structured workout .fit-files - add that fact to docs #27

Closed
Jawz84 opened this issue Oct 16, 2023 · 12 comments
Closed

Comments

@Jawz84
Copy link

Jawz84 commented Oct 16, 2023

Thank you for writing and maintaining Garth!

I just wanted to let you know that - unsurprisingly - Garmin does not allow uploading structured workout files to the upload service. It seems to be only intended for Activities.

repro

I created a custom structured workout FIT file, exactly like the cookbook example from the FIT sdk, so a workout for a 10h endurance ride in zone 2, saved as test.FIT.
When I use

with open("test.FIT", "rb") as f:
    uploaded = garth.client.upload(f)

It confronts me with this error message:

Traceback (most recent call last):
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 127, in request
    self.last_resp.raise_for_status()
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 406 Client Error: Not Acceptable for url: https://connectapi.garmin.com/upload-service/upload

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\joskw\GitNoOneDrive\FIT-Garth\try-garth.py", line 33, in <module>
    uploaded = garth.client.upload(f)
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 173, in upload
    resp = self.post(
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 139, in post
    return self.request("POST", *args, **kwargs)
  File "C:\Users\joskw\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\garth\http.py", line 129, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 406 Client Error: Not Acceptable for url: https://connectapi.garmin.com/upload-service/upload

I know there is no way for you to fix this. I just wanted to suggest that it would be helpful for others to mention this limitation in the documentation here: https://github.com/matin/garth#upload

@matin
Copy link
Owner

matin commented Oct 16, 2023

Could you pass me the .fit file to see if I can reproduce the issue?

@Jawz84
Copy link
Author

Jawz84 commented Oct 16, 2023

Yes, sure! Repro code and file can be found here: https://github.com/Jawz84/Garth-Upload-Issue-Repro

@matin
Copy link
Owner

matin commented Oct 16, 2023

I'll give it a try

@Jawz84
Copy link
Author

Jawz84 commented Oct 16, 2023

I have also pushed the repo with which I created the test.FIT file, if you'd like to play with that. (dotnet core sdk required)
https://github.com/Jawz84/create-fit-workout-file

@matin
Copy link
Owner

matin commented Oct 17, 2023

This doesn't appear to be a Garth issue.

I just tried to upload the FIT file manually using the following page, and I receive the error below:
https://connect.garmin.com/modern/import-data

image

Here's what I'm able to read from test.FIT:

{
    'file_id_mesgs': [{
        'type': 'workout',
        'manufacturer': 'development',
        'product': 1,
        'serial_number': 1066405380,
        'time_created': datetime.datetime(2023, 10, 16, 15, 43, tzinfo=datetime.timezone.utc)
    }],
    'workout_mesgs': [{
        'wkt_name': 'Bike Workout',
        'sport': 'cycling',
        'num_valid_steps': 1
    }],
    'workout_step_mesgs': [{
        'message_index': 0,
        'wkt_step_name': 'Endurance Ride',
        'notes': 'Keep your HR in Zone 2 for the entire ride.',
        'intensity': 'active',
        'duration_type': 'time',
        'duration_value': 36000000,
        'target_type': 'heart_rate',
        'target_value': 2,
        'duration_time': 36000.0,
        'target_hr_zone': 2
    }]
}

In comparison, here's the contents of the test FIT file I use in the Garth tests:

{
    "file_id_mesgs": [
        {
            "serial_number": 3329978681,
            "time_created": "2023-09-29T00:10:58+00:00",
            "manufacturer": "garmin",
            "product": 3291,
            "type": "activity",
            "garmin_product": "fenix6x"
        }
    ],
    "file_creator_mesgs": [
        {
            "software_version": 2600
        }
    ],
    "288": [
        {
            "253": 1064880657
        }
    ],
    "327": [
        {
            "253": 1064880657,
            "3": 12,
            "4": 8352,
            "5": 4,
            "0": 9,
            "1": 1,
            "2": 2,
            "6": 0
        },
        {
            "253": 1064880657,
            "3": 12,
            "4": 8352,
            "5": 4,
            "0": 9,
            "1": 1,
            "2": 2,
            "6": 0
        }
    ],
    "326": [
        {
            "253": 1064880657,
            "0": 49,
            "1": 3
        }
    ],
    "event_mesgs": [
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "data": 0,
            "event": "timer",
            "event_type": "start",
            "event_group": 0,
            "timer_trigger": "manual"
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "data": 0,
            "event": "timer",
            "event_type": "stop_all",
            "event_group": 0,
            "timer_trigger": "manual"
        },
        {
            "timestamp": "2023-09-29T00:11:13+00:00",
            "data": 216,
            "event": 48,
            "event_type": "marker",
            "event_group": 1
        }
    ],
    "device_info_mesgs": [
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "serial_number": 3329978681,
            "manufacturer": "garmin",
            "product": 3291,
            "software_version": 26.0,
            "device_index": "creator",
            "source_type": "local",
            "garmin_product": "fenix6x"
        },
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "manufacturer": "garmin",
            "product": 3291,
            "software_version": 26.0,
            "device_index": 1,
            "device_type": 4,
            "source_type": "local",
            "garmin_product": "fenix6x",
            "local_device_type": "barometer"
        },
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "device_index": 2,
            "device_type": 8,
            "source_type": "local",
            "local_device_type": 8
        },
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "software_version": 1.0,
            "device_index": 3,
            "device_type": 10,
            "source_type": "local",
            "local_device_type": "whr"
        },
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "manufacturer": "garmin",
            "product": 3296,
            "software_version": 22.09,
            "device_index": 4,
            "device_type": 12,
            "source_type": "local",
            "garmin_product": 3296,
            "local_device_type": "sensor_hub"
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "serial_number": 3329978681,
            "manufacturer": "garmin",
            "product": 3291,
            "software_version": 26.0,
            "device_index": "creator",
            "source_type": "local",
            "garmin_product": "fenix6x"
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "manufacturer": "garmin",
            "product": 3291,
            "software_version": 26.0,
            "device_index": 1,
            "device_type": 4,
            "source_type": "local",
            "garmin_product": "fenix6x",
            "local_device_type": "barometer"
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "device_index": 2,
            "device_type": 8,
            "source_type": "local",
            "local_device_type": 8
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "software_version": 1.0,
            "device_index": 3,
            "device_type": 10,
            "source_type": "local",
            "local_device_type": "whr"
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "manufacturer": "garmin",
            "product": 3296,
            "software_version": 22.09,
            "device_index": 4,
            "device_type": 12,
            "source_type": "local",
            "garmin_product": 3296,
            "local_device_type": "sensor_hub"
        }
    ],
    "22": [
        {
            "253": 1064880657,
            "4": 3,
            "5": 3
        }
    ],
    "141": [
        {
            "253": 1064880657,
            "1": 1064793600,
            "2": 1065398400,
            "0": 1
        }
    ],
    "device_settings_mesgs": [
        {
            "utc_offset": 0,
            "time_offset": 4294945696,
            "auto_activity_detect": 2147483647,
            "autosync_min_steps": 2000,
            "autosync_min_time": 240,
            "active_time_zone": 0,
            "3": 2,
            "time_mode": "hour24",
            "time_zone_offset": 0.0,
            "10": 0,
            "11": 3,
            "backlight_mode": "auto_brightness",
            "13": 4,
            "14": 30,
            "15": 50,
            "22": 0,
            "23": 1,
            "25": 1,
            "26": 254,
            "30": 1,
            "35": 1,
            "activity_tracker_enabled": 1,
            "38": 1,
            "41": 1,
            "42": 1,
            "43": 0,
            "45": 1,
            "move_alert_enabled": 0,
            "date_mode": "month_day",
            "48": 0,
            "53": 1,
            "mounting_side": "left",
            "63": [
                1,
                0,
                0,
                0,
                0,
                0,
                0,
                1,
                0,
                1,
                0,
                1,
                1
            ],
            "64": 1,
            "65": 0,
            "66": 2,
            "67": 1,
            "68": 1,
            "69": 3,
            "75": 1,
            "76": 1,
            "77": 9,
            "lactate_threshold_autodetect_enabled": 1,
            "81": 1,
            "82": 1,
            "83": 2,
            "84": 0,
            "85": 1,
            "87": 1,
            "96": 0,
            "97": 3,
            "98": 0,
            "101": 2,
            "104": [
                0,
                33,
                4,
                16,
                14,
                12,
                6,
                26,
                3,
                2,
                29,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null
            ],
            "107": 1,
            "108": 1,
            "109": 1,
            "110": 1,
            "111": 1,
            "112": 1,
            "116": 0,
            "117": 2,
            "124": 50,
            "125": 4,
            "126": 1,
            "127": 1,
            "128": 2,
            "129": 0,
            "130": 1,
            "131": 2,
            "132": 0,
            "133": 1,
            "137": 0,
            "138": 0,
            "139": 1,
            "141": 3,
            "142": 0,
            "143": 100,
            "144": 1,
            "145": 1,
            "148": 1,
            "149": 0,
            "151": 0,
            "160": 1,
            "161": 0,
            "163": 0,
            "164": 40,
            "168": 0,
            "170": [
                8,
                7,
                9,
                13,
                11,
                12,
                5,
                6,
                14,
                10,
                1,
                4,
                0,
                2,
                3
            ],
            "177": 5,
            "178": 30,
            "179": 1,
            "180": 1,
            "181": 0,
            "218": 1,
            "219": 1
        }
    ],
    "user_profile_mesgs": [
        {
            "wake_time": 24000,
            "sleep_time": 80400,
            "41": 1044719868,
            "weight": 83.7,
            "37": 125,
            "gender": "male",
            "height": 1.82,
            "language": "english",
            "elev_setting": "metric",
            "weight_setting": "metric",
            "resting_heart_rate": 0,
            "hr_setting": "max",
            "speed_setting": "metric",
            "dist_setting": "metric",
            "activity_class": 50,
            "position_setting": "degree_minute_second",
            "temperature_setting": "metric",
            "24": 84,
            "height_setting": "metric",
            "36": 0,
            "43": 0,
            "44": 17,
            "45": 10,
            "depth_setting": "statute",
            "52": 0,
            "53": 3,
            "54": 4,
            "57": 0,
            "58": 1,
            "60": [
                0,
                0,
                0,
                0,
                0,
                2,
                2
            ],
            "62": 1
        }
    ],
    "147": [
        {
            "0": 2709014500,
            "2": "HRM-Pro:673764",
            "254": 0,
            "32": 3300,
            "33": 1,
            "34": 880,
            "73": 3,
            "1": 0,
            "3": 1,
            "44": 191,
            "45": 1,
            "46": 1,
            "50": [
                84,
                228,
                18,
                126,
                163,
                221
            ],
            "51": 0,
            "52": 0,
            "53": 1,
            "62": 0
        },
        {
            "2": "Beats Fit Pro",
            "254": 1,
            "73": 4,
            "3": 1,
            "50": [
                244,
                212,
                136,
                220,
                233,
                239
            ],
            "51": 2,
            "52": 22
        }
    ],
    "79": [
        {
            "253": 1064880657,
            "16": 3946251331,
            "17": 835847,
            "18": 966027,
            "19": 835620,
            "21": 94287,
            "22": 2019361,
            "25": 24000,
            "26": 80400,
            "29": 2699900,
            "30": 6749800,
            "35": 3945530002,
            "36": 1454365,
            "0": 13060,
            "3": 830,
            "8": 1,
            "9": 639,
            "11": 168,
            "12": 200,
            "13": 125,
            "20": 0,
            "23": -360,
            "33": 0,
            "34": 179,
            "37": 0,
            "1": 38,
            "2": 182,
            "4": 1,
            "5": 70,
            "6": 190,
            "7": 1,
            "10": 42,
            "14": 0,
            "15": 25,
            "27": 12,
            "28": 0
        }
    ],
    "sport_mesgs": [
        {
            "name": "Yoga",
            "10": [
                null,
                85,
                0,
                null
            ],
            "sport": "training",
            "sub_sport": "yoga",
            "5": 1,
            "6": 0,
            "9": 0,
            "11": 1,
            "13": 0,
            "19": [
                0,
                null,
                null
            ],
            "21": 1
        }
    ],
    "13": [
        {
            "4": 100000,
            "31": 160934,
            "41": 16667,
            "254": 0,
            "2": 4167,
            "8": 1389,
            "32": 6706,
            "64": 77,
            "1": 0,
            "3": 6,
            "7": 0,
            "11": 10,
            "12": 0,
            "13": 0,
            "14": 0,
            "15": 0,
            "16": 1,
            "24": 0,
            "27": 0,
            "30": 0,
            "34": 1,
            "35": 0,
            "36": 0,
            "37": 0,
            "40": 1,
            "42": 30,
            "46": 1,
            "55": 0,
            "60": 1,
            "63": 0,
            "65": 0,
            "66": 0,
            "76": 0,
            "78": 1,
            "89": 0,
            "107": 0,
            "108": 0
        }
    ],
    "zones_target_mesgs": [
        {
            "254": 0,
            "functional_threshold_power": 200,
            "max_heart_rate": 190,
            "threshold_heart_rate": 168,
            "hr_calc_type": "percent_max_hr",
            "pwr_calc_type": "percent_ftp",
            "9": 0,
            "10": 1,
            "11": 1,
            "12": 0
        }
    ],
    "record_mesgs": [
        {
            "timestamp": "2023-09-29T00:10:57+00:00",
            "current_stress": 63.0,
            "heart_rate": 86,
            "temperature": 34,
            "135": 176,
            "136": 86
        },
        {
            "timestamp": "2023-09-29T00:10:58+00:00",
            "current_stress": 63.0,
            "heart_rate": 85,
            "temperature": 34,
            "135": 176,
            "136": 85
        },
        {
            "timestamp": "2023-09-29T00:10:59+00:00",
            "current_stress": 63.0,
            "heart_rate": 86,
            "temperature": 34,
            "135": 176,
            "136": 86
        },
        {
            "timestamp": "2023-09-29T00:11:00+00:00",
            "current_stress": 63.0,
            "heart_rate": 87,
            "temperature": 34,
            "135": 176,
            "136": 87
        },
        {
            "timestamp": "2023-09-29T00:11:01+00:00",
            "current_stress": 63.0,
            "heart_rate": 86,
            "temperature": 34,
            "135": 176,
            "136": 86
        },
        {
            "timestamp": "2023-09-29T00:11:02+00:00",
            "current_stress": 63.0,
            "heart_rate": 86,
            "temperature": 34,
            "135": 176,
            "136": 86
        },
        {
            "timestamp": "2023-09-29T00:11:04+00:00",
            "current_stress": 63.0,
            "heart_rate": 89,
            "temperature": 34,
            "135": 176,
            "136": 89
        },
        {
            "timestamp": "2023-09-29T00:11:05+00:00",
            "current_stress": 63.0,
            "heart_rate": 88,
            "temperature": 34,
            "135": 176,
            "136": 88
        },
        {
            "timestamp": "2023-09-29T00:11:06+00:00",
            "current_stress": 60.0,
            "heart_rate": 88,
            "temperature": 34,
            "135": 176,
            "136": 88
        },
        {
            "timestamp": "2023-09-29T00:11:07+00:00",
            "current_stress": 60.0,
            "heart_rate": 87,
            "temperature": 34,
            "135": 176,
            "136": 87
        }
    ],
    "233": [
        {
            "2": [
                27,
                1,
                4,
                0
            ]
        },
        {
            "2": [
                30,
                160,
                15,
                11
            ]
        },
        {
            "2": [
                8,
                0,
                0,
                16
            ]
        },
        {
            "2": [
                10,
                0,
                0,
                24
            ]
        },
        {
            "2": [
                10,
                64,
                9,
                32
            ]
        },
        {
            "2": [
                4,
                94,
                5,
                40
            ]
        },
        {
            "2": [
                192,
                31,
                240,
                55
            ]
        },
        {
            "2": [
                174,
                200,
                2,
                56
            ]
        },
        {
            "2": [
                40,
                100,
                32,
                64
            ]
        },
        {
            "2": [
                12,
                0,
                12,
                72
            ]
        },
        {
            "2": [
                0,
                0,
                0,
                80
            ]
        },
        {
            "2": [
                27,
                1,
                4,
                0
            ]
        },
        {
            "2": [
                30,
                160,
                15,
                11
            ]
        },
        {
            "2": [
                18,
                0,
                0,
                16
            ]
        },
        {
            "2": [
                10,
                0,
                0,
                24
            ]
        }
    ],
    "set_mesgs": [
        {
            "timestamp": "2023-09-29T00:11:00+00:00",
            "duration": 2.917,
            "start_time": "2023-09-29T00:10:57+00:00",
            "message_index": 0,
            "set_type": "active"
        },
        {
            "timestamp": "2023-09-29T00:11:05+00:00",
            "duration": 3.877,
            "start_time": "2023-09-29T00:11:00+00:00",
            "message_index": 1,
            "set_type": "active"
        },
        {
            "timestamp": "2023-09-29T00:11:12+00:00",
            "duration": 2.882,
            "start_time": "2023-09-29T00:11:05+00:00",
            "message_index": 2,
            "set_type": "active"
        }
    ],
    "time_in_zone_mesgs": [
        {
            "timestamp": "2023-09-29T00:11:00+00:00",
            "time_in_hr_zone": [
                2.763,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
            ],
            "reference_mesg": "time_in_zone",
            "reference_index": 0,
            "hr_zone_high_boundary": [
                124,
                137,
                150,
                163,
                177,
                190
            ],
            "hr_calc_type": "percent_max_hr",
            "max_heart_rate": 190,
            "resting_heart_rate": 0,
            "threshold_heart_rate": 168
        },
        {
            "timestamp": "2023-09-29T00:11:05+00:00",
            "time_in_hr_zone": [
                3.872,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
            ],
            "reference_mesg": "time_in_zone",
            "reference_index": 1,
            "hr_zone_high_boundary": [
                124,
                137,
                150,
                163,
                177,
                190
            ],
            "hr_calc_type": "percent_max_hr",
            "max_heart_rate": 190,
            "resting_heart_rate": 0,
            "threshold_heart_rate": 168
        },
        {
            "timestamp": "2023-09-29T00:11:12+00:00",
            "time_in_hr_zone": [
                2.878,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
            ],
            "reference_mesg": "time_in_zone",
            "reference_index": 2,
            "hr_zone_high_boundary": [
                124,
                137,
                150,
                163,
                177,
                190
            ],
            "hr_calc_type": "percent_max_hr",
            "max_heart_rate": 190,
            "resting_heart_rate": 0,
            "threshold_heart_rate": 168
        },
        {
            "timestamp": "2023-09-29T00:11:13+00:00",
            "time_in_hr_zone": [
                9.513,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0
            ],
            "reference_mesg": "session",
            "reference_index": 0,
            "hr_zone_high_boundary": [
                124,
                137,
                150,
                163,
                177,
                190
            ],
            "hr_calc_type": "percent_max_hr",
            "max_heart_rate": 190,
            "resting_heart_rate": 0,
            "threshold_heart_rate": 168
        }
    ],
    "140": [
        {
            "253": 1064880673,
            "2": 5316,
            "3": 5316,
            "5": 316319,
            "6": 82850,
            "7": 0,
            "21": 1419000,
            "24": 1818805,
            "26": 5316,
            "27": 0,
            "28": 0,
            "29": 0,
            "32": 1310720000,
            "35": 9959,
            "37": 5316,
            "38": 0,
            "39": 5316,
            "40": 0,
            "48": 1064859073,
            "54": 0,
            "9": 1,
            "10": 61607,
            "14": 0,
            "15": 0,
            "16": 0,
            "43": 0,
            "44": 0,
            "45": 0,
            "55": 0,
            "0": 90,
            "1": 0,
            "4": 0,
            "8": 0,
            "11": 10,
            "12": 43,
            "13": 0,
            "17": 0,
            "18": 1,
            "19": 20,
            "20": 0,
            "22": 18,
            "23": 0,
            "25": 25,
            "30": -100,
            "31": -1,
            "33": 0,
            "34": 0,
            "41": 0,
            "46": 2,
            "51": 0,
            "53": 0,
            "56": 10
        }
    ],
    "session_mesgs": [
        {
            "timestamp": "2023-09-29T00:11:13+00:00",
            "start_time": "2023-09-29T00:10:57+00:00",
            "total_elapsed_time": 9.676,
            "total_timer_time": 9.676,
            "total_cycles": 0,
            "78": 9676,
            "sport_profile_name": "Yoga",
            "152": 0,
            "training_load_peak": 0.08111572265625,
            "total_grit": NaN,
            "avg_flow": NaN,
            "message_index": 0,
            "total_calories": 1,
            "avg_speed": 65.535,
            "max_speed": 65.535,
            "first_lap_index": 0,
            "num_laps": 3,
            "106": 0,
            "151": 3,
            "178": 1,
            "189": 6300,
            "190": 6000,
            "196": 0,
            "event": "lap",
            "event_type": "stop",
            "sport": "training",
            "sub_sport": "yoga",
            "avg_heart_rate": 87,
            "max_heart_rate": 89,
            "total_training_effect": 0.0,
            "trigger": "activity_end",
            "avg_temperature": 34,
            "max_temperature": 34,
            "81": 0,
            "total_anaerobic_training_effect": 0.0,
            "138": [
                18,
                0
            ],
            "min_temperature": 34,
            "184": 0,
            "188": 0,
            "avg_stress": 62,
            "201": 63
        }
    ],
    "activity_mesgs": [
        {
            "timestamp": "2023-09-29T00:11:13+00:00",
            "total_timer_time": 9.676,
            "local_timestamp": 1064859073,
            "num_sessions": 1,
            "type": "manual",
            "event": "activity",
            "event_type": "stop"
        }
    ]
}

@matin
Copy link
Owner

matin commented Oct 17, 2023

@Jawz84 is it ok to close this out (as it appears the issue is with the FIT file)?

@app4g
Copy link

app4g commented Oct 17, 2023

It's not an issue w/ the FIT file, similar to TP (TrainingPeaks) and possibly some other manufacturer/companies, they do not allow for uploads of (structured) workouts (FIT) files via their web interface. (only via their private APIs that is not exposed via the web)

eg: TP, if you try to upload a structured workout FIT file via their web-interface, it will give you an error. But if works when it is pushed by company X -> TP

Garmin is the same thing. However, with Garmin, the workaround is to manually upload it to the headunit via /NEWFILES directory.

Edit:
There are couple types of FIT files, the 2 major ones are

  1. Completed Activity Workout Files (FIT) - these are the ones which gets generated by your Garmin HeadUnit or some app which records your completed activity (like a bike ride, a yoga workout)
  2. Structured Workout Files (FIT) - These are generated by an app/user that will instruct things like "do 10m at 180w, then rest for 5min at 100w"

@matin
Copy link
Owner

matin commented Oct 17, 2023

they do not allow for uploads of workouts (FIT) files via their web interface. (only via their private APIs that is not exposed via the web)

@app4g What are you basing this on?

Here are three examples of uploading FIT files using Garth or a direct translation of it:

  1. I upload a yoga workout in the tests. You can see the VCR cassette, which includes the successful response after activity creation.
  2. withings-sync syncs FIT files between Withings and Garmin.
  3. peloton-to-garmin implements Garth in C# to upload FIT files from Peloton to Garmin.

@app4g
Copy link

app4g commented Oct 17, 2023

eg: TP, if you try to upload a structured workout FIT file via their web-interface, it will give you an error. But if works when it is pushed by company X -> TP

@matin I missed out the word "structured" in my first statement which you quoted. This was not missed in my subsequent example which I've quoted above.

I have amended my original post to further clarify and reflect that we are talking about Structured Workout FIT as opposed to Completed Workout Activity Files (also FIT) files per this current Thread.

Tq

@matin
Copy link
Owner

matin commented Oct 17, 2023

@app4g Oh! I get the difference now. Thank you for clarifying!

I'll make the clarification in the README.

@Jawz84 thanks for reporting this! I'm not that familiar with FIT files, so this was a great way to learn more.

I'll leave the issue open—until the README is updated.

@Jawz84
Copy link
Author

Jawz84 commented Oct 17, 2023

Thank you both for taking the time 😊

@matin matin closed this as completed in fef269e Oct 18, 2023
@matin
Copy link
Owner

matin commented Oct 18, 2023

@Jawz84 @app4g added the clarification. Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants