Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Python ConversationsApi error

    Posted 06-26-2023 12:54
    No replies, thread closed.

    Hello everybody, Im using the code below but getting error 400. Anyone could tell me what is wrong? Thanks in advance

        ConversationsApi = PureCloudPlatformClientV2.ConversationsApi(apiclient);
        body = PureCloudPlatformClientV2.ConversationActivityQuery() # ConversationActivityQuery | query
        query = '{"metrics":[{"metric":"oAlerting","details":true}],"groupBy":["ani"],"filter":{"type":"","clauses":[{"type":"","predicates":[{"type":"","dimension":"","operator":"","value":""}]}],"predicates":[{"type":"","dimension":"","operator":"","value":""}]},"order":""}'
        body = json.loads(query) 
        api_response = ConversationsApi.post_analytics_conversations_activity_query(body)

     Response:

    Exception when calling ConversationsApi->post_analytics_conversations_activity_query: (400)
    Reason: Bad Request
    HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '211', 'Connection': 'keep-alive', 'Date': 'Mon, 26 Jun 2023 16:32:37 GMT', 'ININ-Correlation-Id': '835a5fe5-9c7f-4fbf-a621-9ad3205d0f6c', 'Strict-Transport-Security': 'max-age=600; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 81639b0c2d006d816b1bf7f223de98fe.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'ATL56-C4', 'X-Amz-Cf-Id': 'QBubMJu4GJlRiyecbEm8-78PlZE_-jlrVYLOLEbRUBQccvWu0MxiWg=='})
    HTTP response body: {"message":"Value [] is not valid for field type [QueryFilterType]. Allowable values are: and, or","code":"invalid.value","status":400,"contextId":"835a5fe5-9c7f-4fbf-a621-9ad3205d0f6c","details":[],"errors":[]}

    #SystemAdministration

    ------------------------------
    Ighor Toth
    ------------------------------


  • 2.  RE: Python ConversationsApi error

    Posted 06-27-2023 10:21
    No replies, thread closed.

    OK, so first-up, I recommend posting over in the Developer forums for queries like this as there are a lot of experienced folks over there.

    That being said, it looks to me from the error that the filter is incorrectly formatted (information is essentially missing). Looking at the query, it would appear that you are not using a filter at all, so I would try removing it from the json. Try

    query='{"metrics":[{"metric":"oAlerting","details":true}],"groupBy":["ani"],"order":""}'


    ------------------------------
    Paul Simpson
    Eventus Solutions Group
    ------------------------------



  • 3.  RE: Python ConversationsApi error

    Posted 06-28-2023 09:52
    No replies, thread closed.

    Thank you very much. BTW, do you know if there is an way to return users statuses, meaning how many users were on/off queue during particular day using this API? I wasnt able to find it



    ------------------------------
    Ighor Toth
    ------------------------------



  • 4.  RE: Python ConversationsApi error

    Posted 07-10-2023 11:37
    No replies, thread closed.

    Sorry, I don't have that to hand.

    If you still need this, try asking over at the Developer Forum.



    ------------------------------
    Paul Simpson
    Eventus Solutions Group
    ------------------------------