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
newuserpowerbi
Regular Visitor

Post Request Embed Token Individual Key

Hi guys,

 

I'm new to PowerBI and I have a question regarding Post request method,

we have a service API that we like to use PowerBI to connect to get data where clients and do reporting,

we tried to setup a connection between powerbi desktop and our API through Post request

 

 

What we have problem is  where do I put in the values for individual key and how do I also send in a request body that's recognized by PowerBI? 

Thanks

 

 

 

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @newuserpowerbi,

 

Based on my research, the PostContents is JSON format, try to specify 

Headers=[#"Content-Type"="application/json"]

What do you mean about the individual key, is it authentication key? If yes, the formula(M) below is for your reference. Smiley Happy

let
    AuthKey = "abc",
    url = "efg",
    Source = Json.Document(Web.Contents(url,[
             
         Headers = [#"Authorization"=AuthKey ,
                    #"Content-Type"="application/json"],
         Content = Text.ToBinary(body) 
             ]   
        ))
in
    Source

Regards

Hi guys,

 

I'm new to PowerBI and I have a question regarding Post request method,

we have a service API that we like to use PowerBI to connect to get data where clients and do reporting,

we tried to setup a connection between powerbi desktop and our API through Post request

 

let

body = "{""username"": ""xxxxxxxxx"",""password"": ""xxxxxxx"",""grant_type"": ""password"",""something"": ""test"",""clientsomething"": ""passwordhere"",}",

url = "https://xxxxxxxxxxxx/token",

GetJson = Web.Contents(url,      [

         Headers = [#"Content-Type"="application/x-www-form-urlencoded"],

         Content = Text.ToBinary(body)

     ])

in

GetJson

 

We can get into the api and see some value but what we have problem is  where do I put in the values for individual key and how do I also send in a request body that's recognized by PowerBI? 

Thanks

Hi @v-ljerr-msft,

Thank you for your reply, we did tried to get that in the body,

we still are not able to send in a request body on http post request

at the end that has keys and values (example below)

we need to get a token in response from our authentication service

 

Actual Code: 

 

let 

body = "{""a key here"": ""a value here"",""the next key"": ""password"",""grant_type"": ""password"",""client_id"": ""Test"",""client"": ""password"",}",
url = "https://xxxxxxxx.com/token",
GetJson = Web.Contents(url, [
Headers = [#"Content-Type"="application/x-www-form-urlencoded"],
Content = Text.ToBinary(body)
])
in
GetJson

 

error message we got==> "datasource.error: web.contents failed to get contents" is the error we get, it looks like
 
 

Thank you for your help

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.