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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

How to get data from a webservice with POST method

I'm trying to get data from a webservice by using the POST-method (JSON formatted), the response would also be JSON. But executing the following code in the advanced query editor...

let
    Quelle = WebAction.Request("POST", "http://server.tld:8080/portal/service/query", 
        [
            Headers = 
                [#"Content-Type" = "application/json"],
                Content=Text.ToBinary("{ ""query"": { ""Sample"": [""B1"", ""B2"", ""B3"", ""B4"", ""B5""] }, ""columns"": [ { ""termName"": ""IC50"" }, { ""termName"": ""OD"" }, { ""termName"": ""Replicate"" }, { ""termName"": ""Sample"" } ] }")
        ]
            
    ),
    json_doc = Json.Document(Quelle),
    tabelle = Record.ToTable(json_doc)
in
    tabelle

...only this very uninformative error message occurs:

Expression.Error: We haven't been given permission to perform actions against this resource.

 

The webservice is locked with credentials so in the data source settings the access is set to 'basic' with entered user name and password. I already tried diverse combinations like also anonymous access or alternative methods like Web.Contents too, but the error message remains unimpressed.

 

Hope, somebody might help..

Thanks

4 REPLIES 4
Anonymous
Not applicable

Hi @ImkeF

 

The error seems to occur earlier, probably not caused by the authentication.

We try to run against an Apache TomCat Server, but this one does not return the answer with this specific error message. On the contrary the webservices access log was empty so it seems like if PBI would not even post anything, otherwise the access log would show that somebody tried to get access even if it's with wrong credentials or so.

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,

unfortunately the bad news is that if the native basic auth in PBI doesn't work, you have to build a custom connector for it as well.

 

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

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,

this message comes from the API you're querying.
Does it use OAauth?
Then you have to create a custom connector unfortunately to get the auth right.

 

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

@ImkeF
That's the case - it is not OAuth but simply Basic Authentication.

Helpful resources

Announcements
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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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