Power Query from Power BI get the Conversation details query

I am trying to call the https://api.mypurecloud.com/api/v2/analytics/conversations/details/query
from the Power BI, but getting the bad request 400

let
Content= "{
""query"": [
{
""interval"": ""2020-06-24T04:00:00.000Z/2020-06-25T04:00:00.000Z"",
""order"": ""asc"",
""orderBy"": ""conversationStart"",
""paging"": {
""pageSize"": 25,
""pageNumber"": 1
}
}
],
""response"": {
""format"": ""json""
}
}",
Source = Json.Document(Web.Contents("https://api.mypurecloud.com/api/v2/analytics/conversations/details/query",
[Headers=[Authorization="Bearer DO NOT POST YOUR AUTH TOKEN PUBLICLY", Accept="application/json", #"Content-Type"="application/json"]
,Content=Text.ToBinary(Content)]))
in
Source

Error:
DataSource.Error: Web.Contents failed to get contents from (400): Bad Request

Any help?

Hello,

I am not familiar with Power Query from Power BI.

But a 400 Bad Request would indicate that your request has a malformed syntax.

Are you sure about the format/value of your Content variable (I mean the use of "query" and "response" attributes)?

If the Content variable is (exactly) supposed to be the body of your HTTP POST request to https://api.mypurecloud.com/api/v2/analytics/conversations/details/query, then it should just be:

Content= "{
""interval"": ""2020-06-24T04:00:00.000Z/2020-06-25T04:00:00.000Z"",
""order"": ""asc"",
""orderBy"": ""conversationStart"",
""paging"": {
""pageSize"": 25,
""pageNumber"": 1
}
}",

Unless the use of "query" and "response" attributes in your Content variable corresponds to some specific settings on Power Query/Power BI side.

Regards,

@Veeraiah_Mannem Do not post auth tokens publicly as anyone with your auth token can access your org. Auth tokens must be handled like passwords. Please take steps to change your Genesys Cloud user's password, secure your org, and check for unauthorized access immediately

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