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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Sam2023
Frequent Visitor

PowerBi - Getting 404 but works in Postman

I have some issues with Powerbi which is driving me insane.

 

Essentially, I have an API endpoint which accepts a JSON body:

{key1:"value1",key2:"value2"}

It is a GET request on an endpoint: https://website.com/api/v1/endpoint

When making the GET request in Postman, everything works fine, and it outputs the response with HTTP 200 OK. In PowerBi (blank query) however, it is returning a 404. I did a console.log on the endpoint, it outputs with Postman, but doesn't output when the same request is made from PowerBi (making me believe its not even reaching the URL).

 

The Postman body looks like this:

 

Sam2023_4-1702588931118.png

 

 

In PowerBi, I am doing this:

= let url = "https://website.com/api/v1/endpoint",
    body = "{""key1"": ""value1"",""key2"": ""value2""}",
    header = [#"Content-Type"= "application/json"],
    response = Web.Contents(url, [Content=Text.ToBinary(body),Headers = header]), 
    Source = Json.Document(response)

in
    Source

I am getting this as a response:

 

Sam2023_5-1702588961296.png

 

 

What is strange, is if I changed the PowerBi Text.ToBinary(body) to Json.FromValue(body), it does reach the endpoint and I can see in the console.log output, the following:

SyntaxError: Unexpected token " in JSON at position 0
    at JSON.parse (<anonymous>)

PowerBi also returns this as an error (note this time it is a 400 and not a 404):

 

Sam2023_6-1702588992859.png

 

 

Any help would be massively appreciated!

The response from the API would return a JSON object which I would then parse into PowerBi as a dataset.

1 ACCEPTED SOLUTION
Sam2023
Frequent Visitor

Thank you for the reply. 

 

I should have been a bit more clear in my question. 

 

The API requires the authentication and key:values in the body. It doesn't have support for url parameters. 

 

 

 

 

View solution in original post

3 REPLIES 3
Sam2023
Frequent Visitor

Thank you for the reply. 

 

I should have been a bit more clear in my question. 

 

The API requires the authentication and key:values in the body. It doesn't have support for url parameters. 

 

 

 

 

Anonymous
Not applicable

HI @Sam2023,

I'm glad to here you find the root casing about this issue.

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @Sam2023,

Perhaps you can try to add optional parameters(e.g. relative path, authorization token in header) to the web connector if it help for your getting data operations:

Using The RelativePath And Query Options With Web.Contents () In Power Bi M Code 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors