Genesys CTI User Forum

Genesys CTI User Forum => Genesys-related Development => Topic started by: genesys_kumar on December 10, 2021, 10:04:37 PM

Title: GetChannel List using GWS Request
Post by: genesys_kumar on December 10, 2021, 10:04:37 PM
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);
            }
        }
Title: Re: GetChannel List using GWS Request
Post by: hsujdik on December 11, 2021, 03:07:59 PM
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
Title: Re: GetChannel List using GWS Request
Post by: genesys_kumar on December 13, 2021, 07:13:31 PM
Thanks hsujdik, i'm able to see the channel list with this request.