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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
mfsoto
Regular Visitor

Get Access Token for API Rest

Hello, 

 

I'm trying to get an access token through an API call, POST method. I´ve tried many ways but I cant manage to accomplish that. Basically I've tried two different codes that lead me to different errors as follow:

 

 

 

 

let
url = "https://xxxxx",
body = "{""email"": ""xx@xx.xom"", ""password"": ""xxx123""}",
Data= Web.Contents(url,[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),
   DataRecord = Json.Document(Data),
   Source=DataRecord 
in
   Source

 

 

 

The first piece of code brings me the following message: 

Web.Contents with the Content option is only supported when connecting anonymously.

 

 

 

 

let
url = "https://xxxxxxx",
body = "{""email"": ""xxx@xx.com"", ""password"": ""xxx123""}",
Parsed_JSON = Json.Document(body),
BuildQueryString = Uri.BuildQueryString(Parsed_JSON),
Source = Json.Document(Web.Contents(url))
in
Source

 

 

 

 

And the second one, this:

Web.Contents could not get the content of https://xxxxxxx : (405): Method Not Allowed.

 

I've been looking up everywhere but haven´t been able to find a solution. Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

1 REPLY 1
Anonymous
Not applicable

@mfsoto 

You may refer to the following post.

https://community.powerbi.com/t5/Desktop/Connect-to-a-Web-Service-sending-parameters/td-p/225510

 

 

Paul Zheng _ Community Support Team

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors