Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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;
Solved! Go to Solution.
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.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |