kayb | 2019-01-03 19:07:10 UTC | #1
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.
tim.smith | 2019-01-03 19:17:29 UTC | #2
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.
kayb | 2019-01-03 20:34:44 UTC | #3
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.accesstoken = f"{tokentouse}" apiinstance = PureCloudPlatformClientV2.AnalyticsApi() body = PureCloudPlatformClientV2.ConversationQuery
Again, Thanks for your time!!!
system | 2019-02-03 20:37:23 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: 4274