mihail | 2023-03-22 11:32:51 UTC | #1
Hi,
I am trying to extract data using /api/v2/analytics/conversations/aggregates/query but I run into the below error
AttributeError Traceback (most recent call last) <ipython-input-53-e99501a7406c> in <module> 12 13
14 api_instance = PureCloudPlatformClientV2.PostAnalyticsConversationsAggregatesQueryRequest()
15 body = PureCloudPlatformClientV2.ConversationAggregationQuery() # ConversationAggregationQuery | query 16
AttributeError: module 'PureCloudPlatformClientV2' has no attribute 'PostAnalyticsConversationsAggregatesQueryRequest'
Below is the python script i am using
region = PureCloudPlatformClientV2.PureCloudRegionHosts.euwest1 PureCloudPlatformClientV2.configuration.host = region.getapihost()
GENESYSCLOUDCLIENTID = 'x' GENESYSCLOUDCLIENTSECRET = 'x'
apiclient = PureCloudPlatformClientV2.apiclient.ApiClient().getclientcredentialstoken(GENESYSCLOUDCLIENTID,GENESYSCLOUDCLIENTSECRET)
Configure OAuth2 access token for authorization: PureCloud OAuth
PureCloudPlatformClientV2.configuration.accesstoken = apiclient.accesstoken api_instance = PureCloudPlatformClientV2.PostAnalyticsConversationsAggregatesQueryRequest() body = PureCloudPlatformClientV2.ConversationAggregationQuery() # ConversationAggregationQuery | query
try:
Query for conversation aggregates
apiresponse = apiinstance.postanalyticsconversationsaggregatesquery(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling PostAnalyticsConversationsAggregatesQueryRequest->postanalyticsconversationsaggregatesquery: %s\n" % e)
Declan_ginty | 2023-03-22 12:29:16 UTC | #2
Hi Mihail,
This seems to be a bug in the python SDK documentation on the api explorer. The correct documentation can be found here on the doc explorer. The api instance should actually be this:
api_instance = PureCloudPlatformClientV2.AnalyticsApi()
Apologies for the inconvenience.
Regards, Declan
mihail | 2023-03-22 12:29:42 UTC | #3
Thanks Declan, that solved it
system | 2023-04-22 12:30:07 UTC | #4
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: 19045