Bulk download from console not working

I am trying to bulk download data from the console. I have several scripts, which have worked before, downloading data in json format. But something seems to have changed. The script to get the header, 

h={

 'DI-Backend':'connectapi.garmin.com',

 'Authorization':'Bearer '+JSON.parse(localStorage.token).access_token

}

returns an error. Does anyone know what has changed and how to fix it?

Regards,

/Pär

  • // 'Authorization':'Bearer '+JSON.parse(localStorage.token).access_token // DELETE
    'connect-csrf-token', document.querySelector('meta[name="csrf-token"]')  // ADD

  • Seems like it should be a : instead of the , ? Thanks!

    On a related note, is there maybe a forum where these kind of scripts are discussed, or is this the main forum for Garmin scripts? 

  • Hi 4050354, I have a similar usecase and I have the same problem. Thanks to your posting I managed to solve the problem with the Authorization. Unfortunately, my scripts still do not work as before. I suppose something else has been changed by Garmin. Maybe some pathes. It would be very helpful for me if you would post some of your scripts - just to compare ... Regards Torsten

  • I'm having problems with my scripts too. They worked fine last year, so something has changed. I'll will probably have time towards the weekend to look them over. I'll post here how it goes...

  • It was a while ago I used the scripts, and something have changed. But first a little bit of my use case. I have trining logs since the 80's that I scan and run thru an OCR engine to get them digital. Then I make tcx files and import into Garmin. But that import is not that good, lot's of data is missing that needs to be scripted in.

    The Copy as fetch works, i.e. it is possible bulk edit activities. It's a little bit messy, I first do a copy as fecth, paste into a Python script that modifies it as needed for all the newly imported trainings. Then copy paste all those into the console. Messy but works.

    What is not working is extracting data, all those scripts have stopped working due to the activity service returns data whose format has changed. I want to extract the data in bulk for several reasons. It turns out that Garmin web does not show older data. The activities are visible in the All activities list, but no detailed data can be shown. Before I exported everything as yaml-files and put in an sqlite db, the it's possibly to extract on a little manner than just the web GUI. I can f.ex. have scripts that extract cumulkative data for a ski vacation. But those scipts does not work anymore.

    So if anyone know the new format that activity-service returns, that info would be appreciated :-) 

  • I decided to ask chatgpt why it doesn't work anymore, got this answer:

    Garmin has fully migrated from /modern/activities to /app/activities. That’s why any attempt to go to /modern/activities redirects you to /app/activities.

    This explains why all the “modern proxy” endpoints fail — Garmin’s new React app uses a different internal API structure, with stricter CSRF protection and session handling.

    In other words:

    • You cannot reliably use the old /modern/proxy/* endpoints anymore.

    • Garmin’s new /app/activities app is designed to prevent console scraping.

    • Direct browser console calls to the API will likely fail or return HTML/login redirects.

      So that's it for the old scripts then I guess until someone posts new ways of doing the same stuff. :-(