David333 | 2024-02-15 22:35:40 UTC | #1
Hello everyone. I'm trying to practice using the PureCloudPlatformClientV2 module with python trying to use a post api
In my example I commented the first line "body" because I read or understood reading other cases that I could use a "json/dictionary" instead of the QueueObservationQuery and I am new with this module I don't know how to use the QueueObservationQuery to create a good json yet. I am using this code:
create an instance of the API class api_instance = PureCloudPlatformClientV2.RoutingApi();
body = PureCloudPlatformClientV2.QueueObservationQuery() # QueueObservationQuery | query
body = {"interval": "2024-02-12/2024-02-13", "timeZone": "GMT", "filter": {"type": "or", "predicates": [{"type": "dimension", "dimension": "queueId", "operator": "matches", "value": "12345678-1234-1234-1234-123456789101" }] }, "metrics": ["nOffered"] } try:
Query for queue observations
apiresponse = apiinstance.postanalyticsqueuesobservationsquery(body)
When the code is executed the response is the next: HTTP response body: {"message":"Value [nOffered] is not valid for field type [QueueObservationMetric]. Allowable values are: oActiveUsers, oAlerting, oInteracting, oMemberUsers, oOffQueueUsers, oOnQueueUsers, oUserPresences, oUserRoutingStatuses, oWaiting","code":"invalid.value","status":400,"contextId":"3ea1a73c-c83f-4bf8-afdb-3081fa58be64","details":[],"errors":[]}
Seems that the json structure it's not ok but if i used the same json with this other example the response it's ok with status code 200 and i can read the json successfully
response_api = f"https://api.{ENVIRONMENT}/api/v2/analytics/conversations/aggregates/query" body = {"interval": "2024-02-12/2024-02-13", "timeZone": "GMT", "filter": {"type": "or", "predicates": [{ "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "12345678-1234-1234-1234-123456789101" }] }, "metrics": ["nOffered"] }
so, if the both jsons have the same structure, I can´t understand why PureCloudPlatformClientV2 does not work fine
Could you help me? Thank you so much for your time
Jerome.Saint-Marc | 2024-02-16 14:12:36 UTC | #2
Hello,
It is because nOffered metric is not available on Queue Observations. nOffered metric is available on Conversations Aggregates Queries. That's why your first request fails (on Queue Observations) and works on second request (conversations aggregates).
You can refer to supported parameters and request schema in the API Explorer: POST /api/v2/analytics/queues/observations/query POST /api/v2/analytics/conversations/aggregates/query
This page also lists supported metrics depending on the type of query: Queue and Routing Observations: https://developer.genesys.cloud/analyticsdatamanagement/analytics/metrics#conversation-observation-metrics https://developer.genesys.cloud/analyticsdatamanagement/analytics/metrics#routing-observation-metrics Conversations Aggregates: https://developer.genesys.cloud/analyticsdatamanagement/analytics/metrics#conversation-aggregate-metrics
Regards,
David333 | 2024-02-23 13:19:46 UTC | #3
Apologise for delay
A lot of thanks Jerome
system | 2024-03-25 13:20:44 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: 24675