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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors