Hello,
There are different things to take into account.
The "/api/v2/telephony/providers/edges/trunks/metrics" returns an array of objects.
I mean: [ {...}, {...}]
When you specify multiple trunks using the trunkIds query parameter, the values are comma separated. But when sending the request, you will need to escape the commas. I mean , becomes %2C.
I have managed this in the Data Action Configuration Request using $esc.url macro.
As a comment on the TrunkIds (you may have noticed that already - but just for the sake of this explanation):
if you have configured a Trunk (in the Genesys Desktop Admin UI - Telephony Trunks), and you have 2 Virtual Edges, you will have a trunkId for the first Edge and a second trunkId for the second Edge.
You can check and get your TrunkIds using "/api/v2/telephony/providers/edges/trunks"
In my Data Action below, in the translationMap, I am retrieving the values for inboundCallCount and outboundCallCount using a JSONPath expression, which builds an array of integers (as a matter of fact, not exactly an array...).
"inboundCallsArrayAsStr": "$[*].calls.inboundCallCount"
The $[*] is the JSONPath expression to get all objects contained in the array we got in the API Response.
Now I need to add the values.
One way to do this would be to return the JSONPath arrays in my Data Action, and then use a Sum() function in an Architect expression.
But that wouldn't be fun enough 
To make the sum in the Data Action, we can use the $math macros .
But that is why I said the JSONPath array is not really an array in our translationMap.
It is in fact considered as a string which contains "[1, 0, 2, ...]" and we can't pass this variable directly to the getTotal function (in math macros).
So we will need to work around this - we will parse and convert the translationMap variable to go from "[1, 0, 2, ..]." to an array of integers using a velocity macro.
#set ($inboundCallsArray = $inboundCallsArrayAsStr.replace(\"[\", \"\").replace(\"]\", \"\").replace(\" \", \"\").split(\",\"))
We can then make the sum with:
$math.getTotal(${inboundCallsArray})
And here is the final Data Action I have used.
Input Contract:
{
"type": "object",
"required": [
"trunkIds"
],
"properties": {
"trunkIds": {
"type": "string"
}
},
"additionalProperties": true
}
Output Contract:
{
"type": "object",
"properties": {
"nbInboundCalls": {
"type": "integer"
},
"nbOutboundCalls": {
"type": "integer"
}
},
"additionalProperties": true
}
Configuration Request:
{
"requestUrlTemplate": "/api/v2/telephony/providers/edges/trunks/metrics?trunkIds=$esc.url(${input.trunkIds})",
"requestType": "GET",
"headers": {
"Content-Type": "application/json"
},
"requestTemplate": "${input.rawRequest}"
}
Configuration Response:
{
"translationMap": {
"inboundCallsArrayAsStr": "$[*].calls.inboundCallCount",
"outboundCallsArrayAsStr": "$[*].calls.outboundCallCount"
},
"translationMapDefaults": {
"inboundCallsArrayAsStr": "[0]",
"outboundCallsArrayAsStr": "[0]"
},
"successTemplate": "#set ($inboundCallsArray = $inboundCallsArrayAsStr.replace(\"[\", \"\").replace(\"]\", \"\").replace(\" \", \"\").split(\",\")) #set ($outboundCallsArray = $outboundCallsArrayAsStr.replace(\"[\", \"\").replace(\"]\", \"\").replace(\" \", \"\").split(\",\")) {\"nbInboundCalls\":$math.getTotal(${inboundCallsArray}), \"nbOutboundCalls\":$math.getTotal(${outboundCallsArray})}"
}
Hope this helps.
Regards,