This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
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.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.