WebAction.Request

Updated on

WebAction.Request is a Power Query M function that creates an action for executing a method request against a URL using HTTP and returns binary content. The function returns the results of performing the method request as a binary value, but is disabled in most contexts.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

WebAction.Request(
   method as text,
   url as text,
   optional options as nullable record,
) as any
ArgumentAttributeDescription
methodspecifies the HTTP method to be used for the web request, defined by WebMethod.Type. The available options include:
WebMethod.Delete: Used for removing resources.
WebMethod.Get: Typically used for retrieving data.
WebMethod.Head: Requests headers identical to a GET request but without the response body.
WebMethod.Patch: Used for making partial updates to resources.
WebMethod.Post: Commonly used for submitting data to be processed.
WebMethod.Put: Typically used for updating or replacing resources.
urlThe URL to run the request against.
optionsoptionalYou can specify additional properties for the request. The available options are explained below.

Description

The WebAction.Request function generates an action to execute a specified HTTP method request against a URL, returning the result as a binary value. Users can choose from various HTTP methods for different web request needs. An optional record parameter, options, may be provided to specify additional properties. The record can contain the following fields:

  • Query : Programmatically add query parameters to the URL without having to worry about escaping.
  • ApiKeyName : If the target site has a notion of an API key, this parameter can be used to specify the name (not the value) of the key parameter that must be used in the URL. The actual key value is provided in the credential.
  • Headers : Specifying this value as a record will supply additional headers to an HTTP request.
  • Timeout : Specifying this value as a duration will change the timeout for an HTTP request. The default value is 100 seconds.
  • ExcludedFromCacheKey : Specifying this value as a list will exclude these HTTP header keys from being part of the calculation for caching data.
  • IsRetry : Specifying this logical value as true will ignore any existing response in the cache when fetching data.
  • ManualStatusHandling : Specifying this value as a list will prevent any builtin handling for HTTP requests whose response has one of these status codes.
  • RelativePath : Specifying this value as text appends it to the base URL before making the request.
  • Content : Specifying this value will cause its contents to become the body of the HTTP request.

Note that this function is disabled in most contexts. Consider using Web.Contents or Web.Headers instead.

Examples

Perform a GET request against Bing.

// Output: Action
WebAction.Request( WebMethod.Get, "https://bing.com" )

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/webaction-request