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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi there. Below is a shortened version of the code I'm having problems with.
let
Source = Json.Document(Web.Contents("https://statdata.pgatour.com/r/004/2020/leaderboard-v2.json?userTrackingId=exp=0579883146~acl=*~hmac=e4a005fec9674e17425005689e8c5fa8d2f8d6f28492c400cdfbd4988a2163c5")),
ErrorHandling = try Source otherwise null
in
Source
In the full code the tracking id does update so it doesn't return an error but I want to ensure that if the tracking id doesn't update, it does not crash/stop refreshing. Normal error handling doesn't seem to capture the "access to this source is forbidden". Any suggestions?
Thanks
Solved! Go to Solution.
Hello @Anonymous
exactly. The Web.Contents status handling can't be retrieved by error handling. You have to gor for the Web.Contents-responses meta data to retrieve the status code. Using it's result to understand whether it was okay or not. Try out this code to understand how it works
let
response = Web.Contents(
"https://api.census.gov/data/2018/pep/population?get=POP&for=states",
[
ManualStatusHandling = {400,401,403,404,429,500,503}
]
),
responseMetadata = Value.Metadata(response),
responseCode = responseMetadata[Response.Status]
in
responseCode
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @Anonymous
exactly. The Web.Contents status handling can't be retrieved by error handling. You have to gor for the Web.Contents-responses meta data to retrieve the status code. Using it's result to understand whether it was okay or not. Try out this code to understand how it works
let
response = Web.Contents(
"https://api.census.gov/data/2018/pep/population?get=POP&for=states",
[
ManualStatusHandling = {400,401,403,404,429,500,503}
]
),
responseMetadata = Value.Metadata(response),
responseCode = responseMetadata[Response.Status]
in
responseCode
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
ah I see, very clever! Should be able to make that work thanks!