This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I have heeps of activities saved as cycling. How can I batch change every Cycling file to Road Cycling

Hi , I just want to change everything I have stored as "Cycling" to " Road Cycling" and leave everything else as it is. Suspect some wiz might know how to do this.

Top Replies

All Replies

  • As in this thread: How to batch edit uploaded activities?

    Just change a type and add IF to edit only cycling.

    Like this. Change limit as needed, but better test it on smaller number to be sure if it works as you want.

    jQuery.getJSON(
        'https://connect.garmin.com/modern/proxy/activitylist-service/activities/search/activities?limit=1',
        function(act_list)
        {
            act_list.forEach(
            function(act)
            {
                if (act.activityType.typeKey === 'cycling')
                {
                    fetch('https://connect.garmin.com/modern/proxy/activity-service/activity/' + act.activityId,
                    {
                        'headers': { 'Content-Type': 'application/json', 'NK': 'NT', 'X-HTTP-Method-Override': 'PUT' },
                        'body': '{"activityTypeDTO":{"typeKey":"road_biking"},"activityId":' + act.activityId + '}',
                        'method': 'POST'
                    })
                    console.dir(act.activityId, act.activityName, act.startTimeLocal)
                }
            })
        })