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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.