Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Post Request with Power Query

Hey,

Hi I am trying to send a REST POST API request.
This is the URL: https://api.mypurecloud.de/api/v2/analytics/conversations/aggregates/query
This is the body: 

{
  "interval""2022-04-18T08:00:00.000Z/2022-04-18T08:30:00.000Z",

  "groupBy": [
    "userId"
  ],
  "metrics": [
    "tTalk"
  ],
  "filter": {
    "type""and",
    "predicates": [
      {
        "dimension""mediaType",
        "value""voice"
      }
    ]
  }
}
 
This is how it looks like in Postman:
yaelmo_1-1650827327083.png

 

 
And this is the response:
 
yaelmo_0-1650827093533.png

 

 

I'm trying to send this request in PowerBI, and this is what i got until far.
I don't know where am I wrong...

let
url="https://api.mypurecloud.de/api/v2/analytics/conversations/aggregates/query",
body= "{

""interval"": ""2022-04-18T08:00:00.000Z/2022-04-18T08:30:00.000Z"",

""groupBy"": [
""userId""
],
""metrics"": [
""tTalk""
],
""filter"": {
""type"": ""and"",
""predicates"": [
{
""dimension"": ""mediaType"",
""value"": ""voice""
}
]
},
""paging"": {
""pageSize"": 25,
""pageNumber"": 1
}

}",

json="{""mediaType"":""voice"",""userId"":"" ************* "",""interval"":""2022-04-18T08:00:00.000Z/2022-04-18T08:30:00.000Z"",""metric"":""tTalk"",""max"":""52950"",""min"":""52950"",""count"":""1"",""sum"":""52950""}",
Parsed_JSON = Json.Document(json),
BuildQueryString = Uri.BuildQueryString(Parsed_JSON),
WebCall = Web.Contents(url, [Headers=[Authorization="Bearer ***************************", Accept="application/json", #"Content-Type"="application/json"]]),
LinesFromBinary = Lines.FromBinary(WebCall),
#"Converted to Table" = Table.FromList(LinesFromBinary, Splitter.SplitTextByDelimiter(":"), null, null, ExtraValues.Error)
in
#"Converted to Table"


yaelmo_2-1650827573440.png

 

Would appreciate your help 🙂

@Anonymous @Post

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

We don't support authenticating to a website in this way. The only supported way is to use a custom connector.

 

That being said:

To make a POST call add:

WebCall = ... #"Content-Type"="application/json"],Content=Json.Document(Parsed_JSON)])

 

You can remove the unused BuildQueryString = Uri.BuildQueryString(Parsed_JSON),

View solution in original post

4 REPLIES 4
artemus
Microsoft Employee
Microsoft Employee

We don't support authenticating to a website in this way. The only supported way is to use a custom connector.

 

That being said:

To make a POST call add:

WebCall = ... #"Content-Type"="application/json"],Content=Json.Document(Parsed_JSON)])

 

You can remove the unused BuildQueryString = Uri.BuildQueryString(Parsed_JSON),

Anonymous
Not applicable

@artemus -It worked, thank you! 

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
you have to use the "Content"-parameter to create a POST request in Power Query:
Easy POST requests with Power BI and Power Query using Json.FromValue – The BIccountant

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

This is my first time working with Power Query, I didn't understand how i need to apply this on my request.
Can you please guide me in more detail?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors