Evaluation Query Filters for conversation details API endpoint?

I'm trying to retrieve evaluations, which exist or have a deleted dimension in their response from /api/v2/analytics/conversations/details/query using the Python SDK.

from PureCloudPlatformClient V2 import EvaluationDetailQueryPredicate, EvaluationDetailQueryFilter


evaluation_detail_query_predicate_evaluationId = EvaluationDetailQueryPredicate()
evaluation_detail_query_predicate_evaluationId.dimension = 'evaluationId'
evaluation_detail_query_predicate_evaluationId.operator = 'exists'
evaluation_detail_query_predicate_evaluationId.type = 'dimension'

evaluation_detail_query_predicate_deleted = EvaluationDetailQueryPredicate()
evaluation_detail_query_predicate_deleted.dimension = 'deleted'
evaluation_detail_query_predicate_deleted.operator = 'exists'
evaluation_detail_query_predicate_deleted.type = 'dimension'

predicates = [evaluation_detail_query_predicate_evaluationId, evaluation_detail_query_predicate_deleted]

evaluation_detail_query_filter = EvaluationDetailQueryFilter()
evaluation_detail_query_filter.predicates = predicates
evaluation_detail_query_filter.type = 'or'

Does this code make sense to pass to the body of post_analytics_conversations_details_query ??

In the API explorer I'm receiving results with deleted key, but not via the Python SDK.

Trevor,

I'm not sure what HTTP request library you are using, but can you turn on logging to validate that the request contains everything that you think it should? This StackOverflow post might help figure out how to turn on that logging: https://stackoverflow.com/questions/10588644/how-can-i-see-the-entire-http-request-thats-being-sent-by-my-python-application

If you can get the output of the HTTP request then you can compare that to the API Explorer on Analytics Query Builder tools to see if there are any differences.

This is all being done via the PureCloud Python SDK library. Not via requests or anything.

I've logged out the output of the variables I listed above and it's identical to the query I've tested in the API explorer.

Here's a sample from my application logging:

{'interval': '2020-03-23T00:00:00+00:00/2020-04-23T23:59:59.999999+00:00', 
'paging': {'page_number': 1, 'page_size': 100}, 
'evaluationFilters': [{'clauses': None,
 'predicates': [{'dimension': 'evaluationId',
                 'metric': None,
                 'operator': 'exists',
                 'range': None,
                 'type': 'dimension',
                 'value': None},
                {'dimension': 'deleted',
                 'metric': None,
                 'operator': 'exists',
                 'range': None,
                 'type': 'dimension',
                 'value': None}],
 'type': 'or'}]}

And the same request copied from the API explorer:

{"interval": "2020-03-23T00:00:00+00:00/2020-04-23T23:59:59.999999+00:00", 
"paging": {"page_number": 1, "page_size": 100},
 "evaluationFilters": [{"predicates": [{"dimension": "evaluationId",
                 "operator": "exists",
                 "type": "dimension"},
                {"dimension": "deleted",
                 "operator": "exists",
                 "type": "dimension"}],
 "type": "or"}]}

Could it be the fact that some of the values are being passed with None ? I'd imagine the Python SDK would serialize this Python object to an acceptable JSON payload, but maybe not?

Not sure about the actual cause of the issue but as an alternative to building the query with Python objects, you can use the JSON directly as the argument for the API call (technically it will be a Python dict).

So example:

query = {"interval": "2020-03-23T00:00:00+00:00/2020-04-23T23:59:59.999999+00:00", 
"paging": {"page_number": 1, "page_size": 100},
 "evaluationFilters": [{"predicates": [{"dimension": "evaluationId",
                 "operator": "exists",
                 "type": "dimension"},
                {"dimension": "deleted",
                 "operator": "exists",
                 "type": "dimension"}],
 "type": "or"}]}

query_result = analytics_api.post_analytics_conversations_details_query(query)

You can validate what the request payload looks like by using the to_json method on the request model and inspecting the result. E.g. ConversationQuery.to_json(). Depending on your use case though, working with raw JSON like PrinceMerluza suggests may be easier than using the built-in classes to construct the request.

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