apiclient = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(os.environ['CLIENT_ID'], os.environ['CLIENT_SECRET'])
authApi = PureCloudPlatformClientV2.AuthorizationApi(apiclient)
print(authApi.get_authorization_permissions())
api_instance= PureCloudPlatformClientV2.ConversationsApi()
page_size= 5000
page_number= 1
interval= '2024-02-06T00:00:00Z/2024-02-10T00:00:00'
try:
# Get call history
api_response = api_instance.get_conversations_calls_history(page_size=page_size, page_number=page_number, interval=interval)
print(api_response)
except ApiException as e:
print("Exception when calling ConversationsApi->get_conversations_calls_history: %s\n" % e)
Output:
C:\Users\tvo1\AppData\Local\Programs\Python\Python311\python.exe C:\Users\tvo1\Python\Python\Genesys-Flask.py
{'entities': [{'domain': 'analytics',
'id': None,
'name': None,
'permission_map': {'agentConversationDetail': [{'action': 'view',
'allows_conditions': True,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'agentConversationDetail',
'label': "Query for an agent's conversation details"}],
'botAggregate': [{'action': 'view',
'allows_conditions': True,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'botAggregate',
'label': 'Query for bot aggregates'}],
'conversationAggregate': [{'action': 'view',
'allows_conditions': True,
'division_aware': True,
'domain': 'analytics',
'entity_type': 'conversationAggregate',
'label': 'Query for conversation aggregates'}],
'conversationDetail': [{'action': 'view',
'allows_conditions': True,
'division_aware': True,
'domain': 'analytics',
'entity_type': 'conversationDetail',
'label': 'Query for conversation details'}],
'conversationProperties': [{'action': 'index',
'allows_conditions': False,
'division_aware': True,
'domain': 'analytics',
'entity_type': 'conversationProperties',
'label': 'Index conversation properties'}],
'dashboardConfigurations': [{'action': 'deleteActive',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Delete dashboard configurations for any active user in the org'},
{'action': 'deleteInactive',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Delete dashboard configurations for any inactive user in the org'},
{'action': 'edit',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Query for dashboard configurations'},
{'action': 'publish',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Make dashboard configurations public'},
{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Query for dashboard configurations'},
{'action': 'viewPrivate',
'allows_conditions': False,
'division_aware': False,
'domain': 'analytics',
'entity_type': 'dashboardConfigurations',
'label': 'Query for private dashboard configurations of any user in the org'}]},
'self_uri': '/api/v2/authorization/permissions'},
{'domain': 'acdvideo',
'id': None,
'name': None,
'permission_map': {'session': [{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'acdvideo',
'entity_type': 'session',
'label': 'View ACD video sessions'}]},
'self_uri': '/api/v2/authorization/permissions'},
{'domain': 'agentUI',
'id': None,
'name': None,
'permission_map': {'defaultPanels': [{'action': 'edit',
'allows_conditions': False,
'division_aware': False,
'domain': 'agentUI',
'entity_type': 'defaultPanels',
'label': 'Edit Agent UI default panel settings'},
{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'agentUI',
'entity_type': 'defaultPanels',
'label': 'View Agent UI default panel settings'}]},
'self_uri': '/api/v2/authorization/permissions'},
{'domain': 'acdscreenshare',
'id': None,
'name': None,
'permission_map': {'chat': [{'action': 'escalate',
'allows_conditions': False,
'division_aware': False,
'domain': 'acdscreenshare',
'entity_type': 'chat',
'label': 'Allows agent to escalate a chat to a screenshare'}],
'session': [{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'acdscreenshare',
'entity_type': 'session',
'label': 'Allows viewing ACD screen share session'}],
'voice': [{'action': 'escalate',
'allows_conditions': False,
'division_aware': False,
'domain': 'acdscreenshare',
'entity_type': 'voice',
'label': 'Allows agent to escalate a voice call to a screenshare'}]},
'self_uri': '/api/v2/authorization/permissions'},
{'domain': 'alerting',
'id': None,
'name': None,
'permission_map': {'alert': [{'action': 'add',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'alert',
'label': 'Add an alert configuration'},
{'action': 'delete',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'alert',
'label': 'Delete an alert configuration'},
{'action': 'edit',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'alert',
'label': 'Edit an alert configuration'},
{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'alert',
'label': 'View alert configurations'}],
'rule': [{'action': 'add',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'rule',
'label': 'Add an alert configuration'},
{'action': 'delete',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'rule',
'label': 'Delete an alert configuration'},
{'action': 'edit',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'rule',
'label': 'Edit an alert configuration'},
{'action': 'view',
'allows_conditions': False,
'division_aware': False,
'domain': 'alerting',
'entity_type': 'rule',
'label': 'View alert configurations'}]},
'self_uri': '/api/v2/authorization/permissions'}],
'first_uri': '/api/v2/authorization/permissions?pageSize=25&pageNumber=1',
'last_uri': '/api/v2/authorization/permissions?pageSize=25&pageNumber=42',
'next_uri': '/api/v2/authorization/permissions?pageSize=25&pageNumber=2',
'page_count': 42,
'page_number': 1,
'page_size': 25,
'previous_uri': None,
'self_uri': '/api/v2/authorization/permissions?pageSize=25&pageNumber=1',
'total': 1035}
Exception when calling ConversationsApi->get_conversations_calls_history: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '201', 'Connection': 'keep-alive', 'Date': 'Fri, 12 Apr 2024 15:54:23 GMT', 'ININ-Correlation-Id': 'a6a78557-6615-4bbe-85f1-838b1673e2c4', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 250c0cb00d06687b06322aeb6c0379f2.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'LAX50-P2', 'X-Amz-Cf-Id': 'x7xDKl0DPtcu1HVYW1F195TxjzIFXXidypaRpUEAztn1_wsdr8ZzlQ=='})
HTTP response body: {"message":"No authentication bearer token specified in authorization header.","code":"authentication.required","status":401,"contextId":"a6a78557-6615-4bbe-85f1-838b1673e2c4","details":[],"errors":[]}