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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
astoz
Frequent Visitor

Third API call not executed

Hi, I am learning Power Query and trying to figure out why the third API call in my code is not being executed, I'm talking about the Post call to webhook named hello4. If I remove the second api call (hello3) the hello4 works but if hello3 is there hello4 is not executed. I've tried to wrap hello4 in function invoke but no luck. Thanks in advance for any help

 

// This file contains your Data Connector logic
section PrivacyRequests;

[DataSource.Kind="PrivacyRequests", Publish="PrivacyRequests.Publish"]
shared PrivacyRequests.Contents = (optional message as text) =>
let
webhook = "https://webhook.site/7934c414-bd62-4b8e-8387-d7afc1554d7e",
url = "https://trial.onetrust.com/api/access/v1/oauth/token",
request = "https://trial.onetrust.com/api/incident/v1/incidents/search?page=0&size=20&sort=createdDate,desc",
requestsingle = "https://trial.onetrust.com/api/incident/v1/incidents/",

postData = "",

GetJson = Web.Contents(url,
[
Headers = [#"Content-Type"="application/x-www-form-urlencoded"],
Content = Text.ToBinary("grant_type=client_credentials&client_id={{client_id}}&client_secret={{client_secret}}")

]
),
FormatAsJson = Json.Document(GetJson),
AccessToken = FormatAsJson[access_token],
AccessTokenHeader = "Bearer " & AccessToken,


incidentid = "b6d86421-039a-4c86-af9c-86ad49442b23",

hello =
let
hello3 = Json.Document(Web.Contents(requestsingle & incidentid, [Headers=[#"Authorization"=AccessTokenHeader, #"Content-Type"="application/json"]])),
hello4 = Web.Contents("https://webhook.site/150646c4-ac6c-45ec-9685-c438434e032f", [Content="hello",Headers=[#"Content-Type"="application/json"]])
in
hello3

in
hello;

1 ACCEPTED SOLUTION
Ehren
Microsoft Employee
Microsoft Employee

Let variables are evaluated lazily. In other words, they're only evaluated when they are referenced by some executing M code. Because your let expression only references hello3 (and not hello4), only hello3 is executed.

View solution in original post

1 REPLY 1
Ehren
Microsoft Employee
Microsoft Employee

Let variables are evaluated lazily. In other words, they're only evaluated when they are referenced by some executing M code. Because your let expression only references hello3 (and not hello4), only hello3 is executed.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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