Update ringnumber for multiple queues

Hi,

I have the following code:

if(window.location.hash) {
    console.log(location.hash);
    var token = getParameterByName('access_token');
    fetch('https://api.mypurecloud.de/api/v2/routing/queues/QueueID/users/UserID', {
    headers: {
        "Authorization": 'bearer ' + token,
        "Content-type": "application/json; charset=UTF-8"
    },
    method: 'PATCH',
    body: JSON.stringify({
        "id": "UserID",
        "ringNumber": 5,
    })
});

This works as intended and updates the ringnumber for that specific queue and user to 5.

However, I want to achieve this for 6 different queues at the same time (with 1 click). Is this possible?

Yes, it is possible.
You can "click" one time and trigger a function/code that will make 6 API calls.
What I mean is that you need to run the same request 6 times.
There are different ways to chain request (javascript).
You can see here for different examples: https://medium.com/@wisecobbler/using-the-javascript-fetch-api-f92c756340f0
As an example, using Promise.all() (at the bottom of the page).

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.