Web.Headers
The function retrieves the headers that have been downloaded from a specified URL and returns them as a record. If desired, an additional record parameter called "options" can be included to specify e...
The function retrieves the headers that have been downloaded from a specified URL and returns them as a record. If desired, an additional record parameter called "options" can be included to specify extra properties. The record can include the following fields:
- Query: Allows for adding query parameters to the URL programmatically without needing to worry about escaping characters.
- ApiKeyName: Used to specify the name (not the value) of the API key parameter if the target site requires an API key. The actual key value is provided in the credentials.
- Headers: If specified as a record, this field will add extra headers to an HTTP request.
- Timeout: If specified as a duration, this field will adjust the timeout for an HTTP request. The default timeout is set to 100 seconds.
- ExcludedFromCacheKey: If specified as a list, this field will exclude certain HTTP header keys from being included in the cache data calculation.
- IsRetry: If set to true, this logical value will disregard any existing response
To retrieve the HTTP headers for "https://bing.com/search?q=Power+Query", we can use the RelativePath and Query options in Power Query. In this case, we set the searchText variable to "Power Query". Then, we use the Web.Headers function with the specified options for RelativePath and Query to retrieve the headers.
The output of this operation will provide us with the following HTTP headers:
- Cache-Control: private, max-age=0
- Content-Encoding: gzip
- Content-Length: 0
- Content-Type: text/html; charset=utf-8
- Date: Tue, 14 Dec 2021 16:57:25 GMT
- Expires: Tue, 14 Dec 2021 16:56:25 GMT
- Vary: Accept-Encoding
Additionally, the meta data included in the output indicates that the Response.Status is 200, indicating a successful retrieval of the HTTP headers.