Manoj_Jaiswal | 2022-03-30 22:22:52 UTC | #1
Hi ,
We want to pull conversation details using APIs as they happen at the interval of 30 min.
Please suggest which API to use. Below API seems is not giving live data
#
import base64, sys, requests, os from datetime import datetime, timedelta import PureCloudPlatformClientV2 from pprint import pprint from PureCloudPlatformClientV2.rest import ApiException
def getintervalstring(): """ Gets an ISO-8601 interval from now for the last 7 days """ now = datetime.now().replace(microsecond=0) weekago = (now - timedelta(minutes=10)).replace(microsecond=0) return f"{ weekago.isoformat() }/{ now.isoformat() }"
print("-------------------------------------------------------------") print("- Querying Queue Historical Statistics -") print("-------------------------------------------------------------")
CLIENTID = os.environ['GENESYSCLOUDCLIENTID'] CLIENTSECRET = os.environ['GENESYSCLOUDCLIENTSECRET'] ORGREGION = os.environ['GENESYSCLOUD_REGION']
region = PureCloudPlatformClientV2.PureCloudRegionHosts[ORGREGION] PureCloudPlatformClientV2.configuration.host = region.getapi_host()
apiclient = PureCloudPlatformClientV2.apiclient.ApiClient() \ .getclientcredentialstoken(CLIENTID, CLIENT_SECRET)
analyticsapi = PureCloudPlatformClientV2.AnalyticsApi(apiclient)
query = PureCloudPlatformClientV2.ConversationQuery() query.interval = getintervalstring() # "2022-03-29T00:00:00/2022-03-29T00:10:00"
print(f"query: {query}")
queryresult = analyticsapi.getanalyticsconversations_details()
queryresult = analyticsapi.postanalyticsconversationsdetailsquery(query)
print(f"queryResult: {query_result}")
system | 2022-04-30 22:21:16 UTC | #2
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: 14111