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!!!!!