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

Offline genesys_kumar

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
GetChannel List using GWS Request
« 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);
            }
        }

Marked as best answer by genesys_kumar on December 14, 2021, 09:13:49 AM

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: GetChannel List using GWS Request
« Reply #1 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

Offline genesys_kumar

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