Doubt about how work PureCloudPlatformClientV2

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
api_response = api_instance.post_analytics_queues_observations_query(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

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:

Conversations Aggregates:

Regards,

Apologise for delay

A lot of thanks Jerome

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