GetRoutingQueues: {"message":"You are not authorized to perform the requested action."

I am getting an error when running the code below.
Error calling GetRoutingQueues: {"message":"You are not authorized to perform the requested action.","code":"not.authorized","status":403,"contextId":"be982a3d-0ae0-4ee2-8689-b26db503cf74","details":[],"errors":[]}

The code works for conversatioin aggregates queries but not GetRoutingQueues

using PureCloudPlatform.Client.V2.Api;
using PureCloudPlatform.Client.V2.Client;
using PureCloudPlatform.Client.V2.Model;
using PureCloudPlatform.Client.V2.Extensions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

RoutingApi apiInstance2 = null;
PureCloudRegionHosts region = PureCloudRegionHosts.eu_west_1;
Configuration.Default.ApiClient.setBasePath(region);
string clientID = "";
string secret = "
****";
var accessTokenInfo = Configuration.Default.ApiClient.PostToken(clientID, secret);
Console.WriteLine("Access token=" + accessTokenInfo.AccessToken);

apiInstance2 = new RoutingApi();
var pageNumber = 1; // int? | Page number (optional) (default to 1)
var pageSize = 10; // int? | Page size (optional) (default to 25)
//var sortOrder = sortOrder_example; // string | Note: results are sorted by name. (optional) (default to asc)
//var name = name_example; // string | Filter by queue name (optional)
var id = new List(); // List | Filter by queue ID(s) (optional)
var divisionId = new List(); // List | Filter by queue division ID(s) (optional)
var peerId = new List(); // List | Filter by queue peer ID(s) (optional)
var hasPeer = true; // bool? | Filter by queues associated with peer (optional)

try
{
// Get list of queues.
QueueEntityListing result = apiInstance2.GetRoutingQueues(pageNumber, pageSize, "", "", id, divisionId, peerId, hasPeer);
Debug.WriteLine("Queues " + result);
}
catch (Exception e)
{
Debug.Print("Exception when calling RoutingApi.GetRoutingQueues: " + e.Message);
}

Hi @Gerard_Tobin
The oauth client you use for the request must have the routing:queue:view permission assigned for this resource.

The corresponding resource is GET /api/v2/routing/queues

You can find the permissions info in the "Operation Information" tab for the resource

Hi jacobshaw,
can you send screenshots or articles showing how to set this permission?

Hi Gerad,

You would need to login into Genesys Cloud Admin and then go to Admin tab (right along the top). From there search for OAuth. In there you will find all of the OAuth credentials created for your org. Select the org in question and then go to the roles tab (an OAuth client is assigned a role). From there you can select the role and any new permissions that are needed.

More information on setting up an OAuth Client can be found here.

Thanks,
John Carnell
Manager, Developer Engagement

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