Legacy Dev Forum Posts

 View Only

Sign Up

Unable to get POST request /api/v2/analytics/teams/activity/query execute successfully

  • 1.  Unable to get POST request /api/v2/analytics/teams/activity/query execute successfully

    Posted 06-05-2025 18:31

    stelapolu | 2024-07-02 17:14:30 UTC | #1

    Tried to execute POST request /api/v2/analytics/teams/activity/query from https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-analytics-teams-activity-query and using postman as well, tried different combinations ... but didn't find a successful combination ...

    Any help is appreciated!

    Tried: { "metrics": [ { "metric": "oTeamOffQueueUsers", "details": false }, { "metric": "oTeamPresences", "details": true } ], "groupBy": ["teamId"], "filter": { "type": "or", "clauses": [ { "type": "or", "predicates": [ { "type": "dimension", "dimension": "organizationPresenceId", "operator": "matches", "value": "ad94cf91-13f7-4072-867b-1720f333df11" } ] } ],

    }, "order": "asc" }

    { "message": "Missing predicate for teamId", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "60f9bf24-9263-4334-bfc7-4d5c21b46520", "details": [], "errors": [] }

    POST /api/v2/analytics/teams/activity/query HTTP/1.1 {"metrics":[{"metric":"oTeamOffQueueUsers","details":true},{"metric":"oTeamPresences","details":true}],"groupBy":["teamId"],"order":"asc","filter":{"type":"or","predicates":[{"type":"dimension","dimension":"teamId","operator":"exists"}]}}

    { "message": "Invalid predicate type for an activity query", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "69664147-842c-44ba-8fec-90ac9d54ba2f", "details": [], "errors": [] }

    {"metrics":[{"metric":"oTeamOffQueueUsers","details":true},{"metric":"oTeamPresences","details":true}],"groupBy":["teamId"],"order":"asc","filter":{"type":"or","predicates":[{"type":"dimension","dimension":"queueId","operator":"exists"}],"clauses":[{"type":"or","predicates":[{"type":"dimension","dimension":"organizationPresenceId","operator":"matches","value":"1234"}]}]}}
    
    {
      "message": "invalid dimension value",
      "code": "bad.request",
      "status": 400,
      "messageParams": {},
      "contextId": "5c2aa352-c82c-4e96-8cfc-89b6609db2c9",
      "details": [],
      "errors": []
    }
    
    -------------------------
    
    crespino | 2024-07-02 18:31:37 UTC | #2
    
    You need to include teamId as a predicate filter.  Something like this should work, if you replace the GUIDs with values from your org:

    { "metrics": [ { "metric": "oTeamOffQueueUsers" }, { "metric": "oTeamPresences", "details": true } ], "filter": { "type": "and", "clauses": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "teamId", "operator": "matches", "value": "fe941d92-7b36-4913-b117-b36ad0a8815f" }, { "type": "dimension", "dimension": "organizationPresenceId", "operator": "matches", "value": "6a3af858-942f-489d-9700-5f9bcdcdae9b" } ] } ] }, "order": "asc", "groupBy": [ "teamId" ] } ```


    stelapolu | 2024-07-03 12:42:15 UTC | #3

    Jim,

    Thanks for taking time to respond.

    Tried that as well yesterday ... but still the same error. Is it possibly a bug?

    { "metrics": [ { "metric": "oTeamOffQueueUsers", "details": false }, { "metric": "oTeamPresences", "details": true } ], "groupBy": ["teamId"], "filter": { "type": "or", "clauses": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "organizationPresenceId", "operator": "matches", "value": "ad94cf91-13f7-4072-867b-1720f333df11" } ] }, { "type": "or", "predicates": [ { "type": "dimension", "dimension": "teamId", "operator": "matches", "value": "9c63607a-117c-496d-a9d9-1d6aa45576eb" } ] } ] }, "order": "asc" }

    { "message": "Missing predicate for teamId", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "34b2116a-5913-46bd-a6db-ecd9e465d1dc", "details": [], "errors": [] }


    stelapolu | 2024-07-17 15:28:41 UTC | #4

    This ticket can be closed. Able to get it working for the following query.

    { "metrics": [ { "metric": "oTeamPresences", "details": true } ], "groupBy": [ "teamId" ], "filter": { "type": "or", "clauses": [ { "type": "or", "predicates": [ { "type": "dimension", "dimension": "teamId", "operator": "matches", "value": "ac63607a-217c-496d-a9d9-1d6aa45576ea" } ] } ], "predicates": [ { "type": "dimension", "dimension": "teamId", "operator": "matches", "value": "ac63607a-217c-496d-a9d9-1d6aa45576ea" } ] }, "order": "asc" }


    system | 2024-08-16 15:29:13 UTC | #5

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


    This post was migrated from the old Developer Forum.

    ref: 27050