Status Code Handling with
Web.Contents function has some built in functionality for dealing with certain HTTP status codes. The default behavior can be overridden in your extension using the
ManualStatusHandling field in the options record.
Web.Contents will automatically retry requests that fail with one of the following status codes:
|429||Too Many Requests|
|509||Bandwidth Limit Exceeded|
Requests will be retried up to 3 times before failing. The engine uses an exponential back-off algorithm to determine how long to wait until the next retry, unless the response contains a
Retry-after header. When the header is found, the engine will wait the specified number of seconds before the next retry. The minimum supported wait time is 0.5 seconds, and the maximum value is 120 seconds.
Retry-after value must be in the
delta-seconds format. The
HTTP-date format is currently not supported.
The following status codes will result in a credentials exception, causing an authentication prompt asking the user to provide credentials (or re-login in the case of an expired OAuth token).
Extensions are able to use the
ManualStatusHandling option with status codes 401 and 403, which is not something that can be done in
Web.Contents calls made outside of an extension context (that is, directly from Power Query).
The follow status codes will result in an automatic redirect to the URI specified in the
Location header. A missing
Location header will result in an error.
Only status code 307 will keep a
POST request method. All other redirect status codes will result in a switch to