GetChannel List using GWS Request

Hi,

Is there a way to get logged in channel lists in WWE, i tried below query but i got “Access Denied” error.

Can you please let me know the issue with this request or anyother options available to get channel lists?

function GetAllDevice() {
try {
let genSoftPhoneURL = “/api/v2/devices”;
let request = new XMLHttpRequest();
request.open(“GET”, gwsURL + genSoftPhoneURL, true);
request.setRequestHeader(“Content-Type”, “application/json”);
request.withCredentials = “true”;
if (userAccount)
request.setRequestHeader(“Authorization”, "Basic " + btoa(userAccount));
request.onload = function () {
var ob = jQuery.parseJSON(request.responseText);
document.getElementById(“resultDisplay”).innerText += "Get All Device ID’s : ";
document.getElementById(“resultDisplay”).innerText += request.responseText;

                //alert(request.responseText);
            };
            request.send();
        }
        catch (err) {
            console.error(err.message);
        }
    }

Is the user that you are using for logging in assigned to the role “admin” or “apiuser” in the htcc section?
(see: https://docs.genesys.com/Documentation/HTCC/latest/API/Roles)

I believe only admin and apiuser roles can retrieve all devices. Otherwise, if you want a logged in agent or supervisor to retrieve only his/her own channels, try using the /api/v2/me/channels endpoint instead

Thanks hsujdik, i’m able to see the channel list with this request.