hello, i am trying to connect and retrieve data from the api /api/v2/analytics/conversations/aggregates/query. i am using a powershell script but i get a blank response, i think that i have a problem with the body of the response.
here is the body:
$body = @{
"groupBy" = @("wrapUpCode")
"filter" = @{
"type" = "and"
"clauses" = @(
@{
"type" = "or"
"predicates" = @(
@{
"type" = "dimension"
"dimension" = "mediaType"
"operator" = "matches"
"value" = "voice"
}
)
},
@{
"type" = "or"
"predicates" = @(
@{
"type" = "dimension"
"dimension" = "queueId"
"operator" = "matches"
"value" = "my queueID"
}
)
}
)
}
"metrics" = @("tAcw", "tHandle", "tTalkComplete", "tHeldComplete")
"interval" = "2024-05-08T03:00:00/2024-05-09T03:00:00"
} | ConvertTo-Json -Depth 10
then i have a write host and this is the response:
any help?
It's usually easier to design the query you want using API Explorer to eliminate any environmental issues or programming bugs. Once you have the query returning the data you expect, then you can implement it in your script and verify it's producing the correct result. The API Explorer resource can be found here: POST /api/v2/analytics/conversations/aggregates/query.
Hey Tim, i remade the query but i keep getting a blank answer.
This is the new json format for the body:
{
"interval": "2024-05-08T03:00:00.000Z/2024-05-09T03:00:00.000Z",
"groupBy": [
"wrapUpCode"
],
"filter": {
"type": "and",
"clauses": [
{
"type": "or",
"predicates": [
{
"type": "dimension",
"dimension": "mediaType",
"operator": "matches",
"value": "voice"
}
]
},
{
"type": "or",
"predicates": [
{
"type": "dimension",
"dimension": "queueId",
"operator": "matches",
"value": "My queueId"
}
]
}
]
},
"metrics": [
"tHandle",
"tHeldComplete",
"tTalkComplete",
"tAcw"
]
}
And this is the write-host for the answer:
$responseObject = $respuesta | ConvertFrom-Json
Iterar sobre los resultados y formatear la salida
foreach ($result in $responseObject.results) {
Write-Host "Response"
Write-Host "{"
Write-Host " "group
": {"
foreach ($key in $result.group.Keys) {
Write-Host " "$key
": "$($result.group[$key])
""
}
Write-Host " },"
Write-Host " "data
": ["
foreach ($data in $result.data) {
Write-Host " {"
Write-Host " "interval
": "$($data.interval)
","
Write-Host " "metrics
": ["
foreach ($metric in $data.metrics) {
Write-Host " {"
Write-Host " "metric
": "$($metric.metric)
","
Write-Host " "stats
": {"
Write-Host " "max
": $($metric.stats.max),"
Write-Host " "min
": $($metric.stats.min),"
Write-Host " "count
": $($metric.stats.count),"
Write-Host " "sum
": $($metric.stats.sum)"
Write-Host " }"
Write-Host " }"
}
Write-Host " ]"
Write-Host " }"
}
Write-Host " ]"
Write-Host "}"
}
A successful query with no results means that no conversations matched your query. I assume "value": "My queueId"
is something you redacted and your actual query is using a real queue ID from your org. If that's your actual query, be sure to use a real ID.
Try removing one or both of the predicates and see if you get data. You can also try using a detail query for the same interval to see what conversations exist so you can validate that there are conversations that should match your query.
Yes, i am using a real queue ID, i get results using this body in another language like Java, but i need to do it in powershell so i can use it inside a SSIS Package.
If the query works in one place and not another, here are a few possible causes:
- You have a typo in the place it doesn't work
- You're using different authorization with different division access to conversations
- The transformation tools you're using to make the request are malforming it in some way
Hello Tim, i am trying a new solution. I am ussing ssis and i keep getting this error "couldnt load assembly" of purecloud, do you know if i have to install the nuget package inside the GAC?
I do know what that is, but it's been more than a decade since I've done anything with .NET. I seem to remember having issues in the past with libraries that weren't strongly signed, and I would guess that our current .NET SDK isn't strongly signed either. The SDK is open source, so you are able to compile your own package and sign it, or just include the source code directly in your existing app. GitHub - MyPureCloud/platform-client-sdk-dotnet: .NET platform client SDK.
For assistance configuring and deploying to your .NET environment, I would suggest working with your coworkers that might be knowledgable about these environmental concerns or looking at .NET focused communities elsewhere online. There's not much .NET expertise within Genesys nor on this forum, so you're not likely to get much help with that aspect here.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.