Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to make a regular, plain HTTP request without getting the popup to specify authentication to get Power BIs approval. The API I am trying to call uses a non-standed authentication that the web authentication wizard will not let me do. I just want to make a plain HTTP request from M, specifying the authentication headers myself. Why is this so hard to do?
I was directed towards WebAction.Request to make a plain HTTP request, but I get the error "Object reference is not set to an instance of an object". The docs says that it "Creates an action that, when executed, will return the results of performing a method request against url using HTTP as a binary value.". What exactly is an "action" that it is referring to and how do I execute it? I cannot find any documentation on what exactly an action is or how to retrieve the response from it.
I wrote this function to make requests to this API, but I get "Object reference is not set to an instance of an object" when I try to call it:
let
Source = (path as text, query as record) =>
let
response = WebAction.Request("get", Text.Combine({"https://xxxxxxxxxxxx.xxx/v4_6_release/apis/3.0", path}), [
Headers = [
Authorization = "Basic xxxxxxxxxxx",
#"Content-Type" = "application/json",
clientId = "xxxxxxxxxxx"
],
Query = query
]),
json = Json.Document(response)
in
json
in
Source
Hi @dte-chris ,
I am not sure whether this is syntax in M code, so as a workaround, I think you could try to use web.content to achieve this goal.
let
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/datasets/<id>/refreshes", [Headers=[Authorization="xxxxxxxx"]]))
in
Source
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply @dax
I know about Web.Contents, but when I use that I get the popup forcing me to specify the authentication through the authentication wizard and it always fails no matter what options I choose. I just want to make the request without Power BI bugging me for its approval, and if there really is an authentication error then I want to be able to view the response.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |