Getting .GPX files from Wellness-api

I'm new to garmin, and i want to fetch the .GPX for plotting a graph.

I'm using apis.garmin.com/.../activityFile to get the file back.

So there is my question : 1) is it possible to get .gpx file directly from api ?

2) I can download a file from this api call. But the file is called 'activityFile' without mime type (ie. not .fit) . The data inside it is corrupted as well. Is there any suggestion for handling this case? 

Thanks!!!!! 

  • The APIs will return the original file created by the device. 99.9% of Garmin devices will create a FIT Activity file. On the rare occasion you may receive a TCX file, and even rarer a GPX.

    You can download the FIT SDK from here:
    developer.garmin.com/.../

    There is a recipe in the FIT SDK Cookbook for decoding Activity files. The code that goes along with the recipe is written in C#, but the concepts can be applied to any of the supported languages.
    https://developer.garmin.com/fit/cookbook/decoding-activity-files/

    In a FIT file latitude and longitude values are stored as semicircles. The formulas to convert between semicircles and degrees are:

    degrees = semicircles * ( 180 / 2^31 )
    semicircles = degrees * ( 2^31 / 180 )