For conversation details query- even after providing interval , I get error :"interval is required"

while pulling conversation details data in python, I get error. I know that we have to provide interval in conversation query.
my code is in python.
Here is my conversation query :
ConversationQuery = {
"interval": "2018-05-10T19:15:00Z/2018-05-17T20:00:00Z"
, "paging" : { "pageSize" : 25 , "pageNumber" : 1},
"orderBy": "segmentStart",
"order": "asc"
}
ConversationQuery = json.dumps(ConversationQuery )
api_instance = PureCloudPlatformClientV2.AnalyticsApi()
body = PureCloudPlatformClientV2.UserDetailsQuery()

Response:
{"status":400,"code":"bad.request","message":"interval is required","messageParams":{},"contextId":"d5d87f13-ecdc-44c9-98e1-c13cb64a4d9d","details":[],"errors":[]}

I think this the correct way to provide Interval in 'body' , Can someone help me to understand what could be wrong here ? Thanks for your time.

Based on the code you've posted, you're not assigning any properties to the request body (variable body). You need to set properties on the body before making the request. I don't think there's a direct way to convert a JSON object to a UserDetailsQuery object unless you are able to use a deserializer to deserialize your JSON object into a python class.

1 Like

Thanks @tim.smith for your message.
Below approach worked for me for conversation detail and user detail.

ConversationQuery = {
"interval": "2018-05-10T19:15:00Z/2018-05-17T20:00:00Z"
, "paging" : { "pageSize" : pageSize , "pageNumber" : pageNumber },
"orderBy": "segmentStart",
"order": "asc"
}
PureCloudPlatformClientV2.ConversationQuery = ConversationQuery
PureCloudPlatformClientV2.configuration.access_token = f"{token_to_use}"
api_instance = PureCloudPlatformClientV2.AnalyticsApi()
body = PureCloudPlatformClientV2.ConversationQuery

Again, Thanks for your time!!!

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