anon8873524 | 2018-10-02 14:04:22 UTC | #1
I'm trying to create a PureCloud Data action to query queue observations for the number of interactions for a given media type interacting and waiting at a point in time. It works, but requires an assumption that the metrics I am searching for are returned in a specific order. i.e. the translation map looks like: "translationMap": { "TotalInteracting": "$['results'][0]['data'][0]['stats']['count']", "TotalWaiting": "$['results'][0]['data'][1]['stats']['count']" } I have tried a translation map below but this errors: "translationMap": { "TotalInteracting": "$['results'][0]['data']['?(@.metric==\"oInteracting\")']['stats']['count']", "TotalWaiting": "$['results'][0]['data']['?(@.metric==\"oWaiting\")']['stats']['count']" }
Can I use a translationMap formatted like this? If not, will the metrics always be returned in the same order? Probably not a great assumption to make though? Is it possible to target the individual metrics accurately from the data action or should I be returning, say, the data element back to Architect and have Architect work through the evaluation?
Thanks in advance,
Jason_Mathison | 2018-10-02 14:17:51 UTC | #2
It certainly seems risky to assume that the order will stay the same. I typically work through making complex JSONPath queries at http://jsonpath.com/
This forum thread has an example of complex JSONPath that filters by name. It might give you some ideas: https://developer.mypurecloud.com/forum/t/get-number-of-waiting-of-a-queue/2831
anon8873524 | 2018-10-02 14:28:43 UTC | #3
Thank you - it may be that I did not escape my quotes, but will also look at the macros - thanks!
system | 2018-11-02 14:28:48 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: 3660