URL Fetch Service

URL Fetch

This service allows scripts to access other resources on the web by fetching URLs. A script can use the UrlFetch service to issue HTTP and HTTPS requests and receive responses. The UrlFetch service uses Google's network infrastructure for efficiency and scaling purposes.

Requests made using this service originate from a set pool of IP ranges. You can look up the full list of IP addresses if you need to whitelist or approve these requests.

This service requires the https://www.googleapis.com/auth/script.external_request scope. In most cases Apps Script automatically detects and includes scopes a script needs, but if you are setting your scopes explicitly you must manually add this scope to use UrlFetchApp .

See also

Classes

Name Brief description
HTTPResponse This class allows users to access specific information on HTTP responses.
UrlFetchApp Fetch resources and communicate with other hosts over the Internet.

HTTPResponse

Methods

Method Return type Brief description
Object Returns an attribute/value map of headers for the HTTP response, with headers that have multiple values returned as arrays.
Blob Return the data inside this object as a blob converted to the specified content type.
Blob Return the data inside this object as a blob.
Byte[] Gets the raw binary content of an HTTP response.
String Gets the content of an HTTP response encoded as a string.
String Returns the content of an HTTP response encoded as a string of the given charset.
Object Returns an attribute/value map of headers for the HTTP response.
Integer Get the HTTP status code (200 for OK, etc.) of an HTTP response.

UrlFetchApp

Methods

Method Return type Brief description
HTTPResponse Makes a request to fetch a URL.
HTTPResponse Makes a request to fetch a URL using optional advanced parameters.
HTTPResponse[] Makes multiple requests to fetch multiple URLs using optional advanced parameters.
Object Returns the request that is made if the operation was invoked.
Object Returns the request that is made if the operation were invoked.