Legacy Dev Forum Posts

 View Only

Sign Up

Need help with Conversation Aggregate Query body

  • 1.  Need help with Conversation Aggregate Query body

    Posted 06-05-2025 18:08

    Trystan | 2022-09-21 06:21:19 UTC | #1

    Hi all,

    Looking at the Python documentation here

    SDK Documentation Explorer (genesys.cloud)

    Here is what I have tried..

    today = datetime.datetime.now(pytz.timezone('Australia/Melbourne')).strftime('%Y-%m-%d') query = { 'interval': f"{today}T00:00:00/{today}T23:59:59", 'granularity': "PT1H", 'timezone': "Australia/Melbourne", 'groupby': ["conversationId","direction","userId","queueId","ani","dnis","wrapUpCode","disconnectType"], 'filter': {"type": "and", "predicates": [{ "dimension": "mediaType", "value": "voice" }, { "dimension": "userId", "operator": "exists" }]}, 'metrics': ["nBlindTransferred","nConnected","nConsult","nConsultTransferred","nError","nOffered","nOutbound","nOutboundAbandoned","nOutboundAttempted","nOutboundConnected","nOverSla","nStateTransitionError","nTransferred","oExternalMediaCount","oMediaCount","oServiceLevel","oServiceTarget","tAbandon","tAcd","tAcw","tAgentResponseTime","tAlert","tAnswered","tContacting","tDialing","tFlowOut","tHandle","tHeld","tHeldComplete","tIvr","tMonitoring","tNotResponding","tShortAbandon","tTalk","tTalkComplete","tUserResponseTime","tVoicemail","tWait"] } body = PureCloudPlatformClientV2.ConversationAggregationQuery(query)

    I am getting the an error body = PureCloudPlatformClientV2.ConversationAggregationQuery(query) TypeError: init() takes 1 positional argument but 2 were given

    I am not sure how to pass my query to this function, any help is appreciated.

    Thanks.


    anon14299330 | 2022-09-23 14:13:00 UTC | #2

    Hi Trystan,

    I am currently looking into this issue. In the mean time, as a work around, you can pass your query object directly to the post_analytics_conversations_aggregates_query() method and this should work.

    For example:

    api_response = api_instance.post_analytics_conversations_aggregates_query({
      "interval": "2017-02-02T13:00:00.000Z/2017-02-03T13:00:00.000Z",
      "granularity": "PT12H",
      "groupBy": [
      	"queueId",
      	"userId"
      ],
      "metrics": [
      	"nOutboundConnected",
      	"tAnswered",
      	"tAbandon",
      	"tHandle"
      ],
      "filter": {
        "type": "and",
        "predicates": [
          {
            "dimension": "mediaType",
            "value": "voice"
          },
          {
            "dimension": "direction",
            "value": "outbound"
          }
        ]
      }
    })
    
    pprint(api_response)

    Please let me know if this temporary solution works for you.

    Thanks,

    Mike


    Trystan | 2022-09-25 22:53:38 UTC | #3

    Hi Mike,

    Yes, this approach works.

    Thank you


    John_Carnell | 2022-09-26 12:57:20 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 16370