node-strava / node-strava-v3

API wrapper for Strava's v3 API, in Node
MIT License
356 stars 109 forks source link

Question: Is it possible to update multiple activities with one API request? #134

Closed bigandy closed 2 years ago

bigandy commented 2 years ago

Situation: I want to update multiple activities with strava.activities.update is it possible or do in one go.

Or would I have to do it once per activity id?

otherwise would this be the best approach?


const selectedActivities = [{id: 1}, {id:2}, {id:3}];

await selectedIds.reduce((promiseChain, currentActivity) => {
    return promiseChain.then(async () => {
        await strava.activities.update({ id: currentActivity.id, name: "has been updated" });
    });
}, Promise.resolve());