Author Topic: GetChannel List using GWS Request  (Read 1904 times)

Offline genesys_kumar

  • Newbie
  • *
  • Posts: 24
  • Karma: 0
GetChannel List using GWS Request
« on: December 11, 2021, 07:04:37 AM »
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);
            }
        }

Marked as best answer by genesys_kumar on December 14, 2021, 06:13:49 PM

Offline hsujdik

  • Sr. Member
  • ****
  • Posts: 483
  • Karma: 17
Re: GetChannel List using GWS Request
« Reply #1 on: December 12, 2021, 12:07:59 AM »
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

Offline genesys_kumar

  • Newbie
  • *
  • Posts: 24
  • Karma: 0
Re: GetChannel List using GWS Request
« Reply #2 on: December 14, 2021, 04:13:31 AM »
Thanks hsujdik, i'm able to see the channel list with this request.