Legacy Dev Forum Posts

 View Only

Sign Up

Error 403 Get Number of On-Queue Agents using Genesys Cloud SDK

  • 1.  Error 403 Get Number of On-Queue Agents using Genesys Cloud SDK

    Posted 06-05-2025 18:08

    asikarwar | 2021-07-20 21:08:03 UTC | #1

    Hi,

    I was following this example using python but getting Error 403, however when I request using developer tools I do see successful query results.

    I was given my client id and client secret, do I lack a specific role/grant, can you please guide as to what exact role i would require to make an api call?


    • Python3 Get Number of On-Queue Agents using Genesys Cloud SDK -

    Enter queue name: TEST_Q Error on RoutingAPI -> (403) Reason: Forbidden HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '106', 'Connection': 'keep-alive', 'Date': 'Tue, 20 Jul 2021 20:46:35 GMT', 'ININ-Correlation-Id': '2769afba-9ea3-4172-9535-d262407e67a6', 'Strict-Transport-Security': 'max-age=600; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 a39967d555ca3537d530d380e47d5378.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'BOM51-C1', 'X-Amz-Cf-Id': 'RghbmcmK9R70tiPrg6qgHAWfEP1QAyNVP5Nt2JK-uyf4pTWGlOAfLw=='}) HTTP response body: {"message":"You are not authorized to perform the requested action.","code":"not.authorized","status":403}

    Error on RoutingAPI -> {"message":"invalid dimension value","code":"bad.request","status":400,"messageParams":{},"contextId":"d3b5a100-04cb-4133-9984-9ac168605cb4","details":[],"errors":[]} Number of agents in "TEST_Q": 0

    Thanks Ashish


    tim.smith | 2021-07-20 21:17:04 UTC | #2

    asikarwar, post:1, topic:11524
    {"message":"You are not authorized to perform the requested action.","code":"not.authorized","status":403}

    There's nothing I can say about this one other than it might have to do with scopes. If you need assistance troubleshooting this error, please open a case with Genesys Cloud Care to investigate; the error message itself and the logging for the correlation ID are insufficient to determine why the permission check failed.

    asikarwar, post:1, topic:11524
    "message":"invalid dimension value"

    I believe this error is saying that you're sending a "dimension":"value" in the request somewhere and that the literal string value is not a valid dimension.


    asikarwar | 2021-07-21 12:30:14 UTC | #3

    Sure, yes I can admin to log a case.

    Also one more thing I was using useast1 for PureCloudRegionHosts[], this should not be an issue!

    I was able to get authorization_permissions using the client id and secret, will this help you?

    authApi = PureCloudPlatformClientV2.AuthorizationApi(apiclient) print(authApi.getauthorizationpermissions())

    {'entities': [{'domain': 'analytics', 'id': None, 'name': None, 'permissionmap': {'botAggregate': [{'action': 'view', 'allowsconditions': True, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'botAggregate', 'label': 'Query for bot aggregates'}], 'botFlowReportingTurn': [{'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'botFlowReportingTurn', 'label': 'Read bot flow reporting turn data'}], 'conversationAggregate': [{'action': 'view', 'allowsconditions': True, 'divisionaware': True, 'domain': 'analytics', 'entitytype': 'conversationAggregate', 'label': 'Query for conversation aggregates'}], 'conversationDetail': [{'action': 'view', 'allowsconditions': True, 'divisionaware': True, 'domain': 'analytics', 'entitytype': 'conversationDetail', 'label': 'Query for conversation details'}], 'conversationProperties': [{'action': 'index', 'allowsconditions': False, 'divisionaware': True, 'domain': 'analytics', 'entitytype': 'conversationProperties', 'label': 'Index conversation properties'}], 'dashboardConfigurations': [{'action': 'edit', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dashboardConfigurations', 'label': 'Query for dashboard configurations'}, {'action': 'publish', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dashboardConfigurations', 'label': 'Make dashboard configurations public'}, {'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dashboardConfigurations', 'label': 'Query for dashboard configurations'}], 'dataExport': [{'action': 'add', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dataExport', 'label': 'Add data export jobs'}, {'action': 'delete', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dataExport', 'label': 'Delete data export jobs'}, {'action': 'edit', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dataExport', 'label': 'Edit data export jobs'}, {'action': 'publish', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dataExport', 'label': 'Email data exports'}, {'action': 'schedule', 'allowsconditions': False, 'divisionaware': False, 'domain': 'analytics', 'entitytype': 'dataExport', 'label': 'Schedule data exports'}]}, 'selfuri': '/api/v2/authorization/permissions'}, {'domain': 'acdvideo', 'id': None, 'name': None, 'permissionmap': {'session': [{'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'acdvideo', 'entitytype': 'session', 'label': 'View ACD video sessions'}]}, 'selfuri': '/api/v2/authorization/permissions'}, {'domain': 'acdscreenshare', 'id': None, 'name': None, 'permissionmap': {'chat': [{'action': 'escalate', 'allowsconditions': False, 'divisionaware': False, 'domain': 'acdscreenshare', 'entitytype': 'chat', 'label': 'Allows agent to escalate a chat to a screenshare'}], 'session': [{'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'acdscreenshare', 'entitytype': 'session', 'label': 'Allows viewing ACD screen share session'}], 'voice': [{'action': 'escalate', 'allowsconditions': False, 'divisionaware': False, 'domain': 'acdscreenshare', 'entitytype': 'voice', 'label': 'Allows agent to escalate a voice call to a screenshare'}]}, 'selfuri': '/api/v2/authorization/permissions'}, {'domain': 'alerting', 'id': None, 'name': None, 'permissionmap': {'alert': [{'action': 'add', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'alert', 'label': 'Add an alert configuration'}, {'action': 'delete', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'alert', 'label': 'Delete an alert configuration'}, {'action': 'edit', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'alert', 'label': 'Edit an alert configuration'}, {'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'alert', 'label': 'View alert configurations'}], 'rule': [{'action': 'add', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'rule', 'label': 'Add an alert configuration'}, {'action': 'delete', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'rule', 'label': 'Delete an alert configuration'}, {'action': 'edit', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'rule', 'label': 'Edit an alert configuration'}, {'action': 'view', 'allowsconditions': False, 'divisionaware': False, 'domain': 'alerting', 'entitytype': 'rule', 'label': 'View alert configurations'}]}, 'selfuri': '/api/v2/authorization/permissions'}], 'firsturi': '/api/v2/authorization/permissions?pageSize=25&pageNumber=1', 'lasturi': '/api/v2/authorization/permissions?pageSize=25&pageNumber=32', 'nexturi': '/api/v2/authorization/permissions?pageSize=25&pageNumber=2', 'pagecount': 32, 'pagenumber': 1, 'pagesize': 25, 'previousuri': None, 'self_uri': '/api/v2/authorization/permissions?pageSize=25&pageNumber=1', 'total': 787}

    Process finished with exit code 0


    Jerome.Saint-Marc | 2021-07-21 13:48:34 UTC | #4

    Hello,

    The Get Number of On-Queue Agents tutorial makes use of two Platform API requests.

    Get list of queues - GET /api/v2/routing/queues Requires permission: routing:queue:view

    Query for queue observations - POST /api/v2/analytics/queues/observations/query Requires permission: analytics:queueObservation:view

    The necessary permissions are listed on each API endpoint (the links above).

    You are probably missing the routing:queue:view permission Ask your admin to verify that the OAuth client you are using has the 2 permissions: routing:queue:view and analytics:queueObservation:view

    Regards,


    asikarwar | 2021-07-21 13:42:19 UTC | #5

    Thank you @Jerome.Saint-Marc :star_struck:

    And what required permission would I need for: /api/v2/analytics/flows/observations/query

    Thanks again Ashish


    Jerome.Saint-Marc | 2021-07-21 13:47:23 UTC | #6

    analytics:flowObservation:view

    As I mentioned above you can find these required permissions in the API description of the endpoint.

    Like for flow observations query: POST /api/v2/analytics/flows/observations/query

    Regards,


    asikarwar | 2021-07-21 13:48:30 UTC | #7

    Oh yes there is a section, thank you once again!


    system | 2021-08-21 13:48:33 UTC | #8

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


    This post was migrated from the old Developer Forum.

    ref: 11524