---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/api-reference

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Fetch - Scoped, Global

# Fetch - Scoped, Global {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read  
The Fetch API provides methods for fetching resources using request and response objects.

You can use the Fetch API in a background script and wherever you can make HTTP calls (like a REST endpoint). The Fetch API allows you to make both simple and more complicated fetch requests by
setting headers, body options, and so on.  
This API is part of a set of Fetch APIs, which provide various actions for fetching resources from external websites. The full Fetch API collection includes:

* [Fetch - fetch(String resource, Object options)](https://servicenow-prod.fluidtopics.net/BjgPgdTN~sDlsIbr8dv_gg#fetch.fetch_S_O "Starts the process of fetching a resource from the network and returns a promise that is fulfilled once the response is available."): Starts the process of fetching a resource from the network.
* [Fetch Headers - Scoped, Global](https://servicenow-prod.fluidtopics.net/QpYPN4iIPDFYc0lpxGykDQ#Fetch.HeadersAPI "The Fetch Headers API allows you to retrieve, set, add to, and remove headers from a list of request or response headers."): Retrieve and modify request and response headers.
* [Fetch Request - Scoped, Global](https://servicenow-prod.fluidtopics.net/W0gJkwIJSZxt9ZBuK47pfg#Fetch.RequestAPI "The Fetch Request API contains methods for creating or retrieving a Request object to allow applications to asynchronously request resources, such as JSON, text, or binary data, from a server, and handle the response. This API supports various HTTP methods like GET, POST, PUT, DELETE, and so on."): Create a new request object.
* [Fetch RequestInit - Scoped, Global](https://servicenow-prod.fluidtopics.net/u~mCRUkZ0_odSqZr~o5F4A#Fetch.RequestInitAPI "The RequestInit API provides options to configure a Fetch request."): Set options to configure a fetch request.
* [Fetch Response - Scoped,Global](https://servicenow-prod.fluidtopics.net/dRaKslSlaxFBm4A0S5Hneg#Fetch.ResponseAPI "The Fetch Response API provides methods for creating a new Response object and for handling the response body created by a Fetch Request API method."): Create a new response object.
{#FetchAPI__ul_akb_fsf_pdc}

To support fetch actions, the system property, `glide.hosts.allowlist`, allows controls over what hosts a fetch method can access. It applies to HTTP APIs like RestMessageV2 and those mentioned
above. For more information about `glide.hosts.allowlist`, see [Available system properties](https://www.servicenow.com/docs/access?context=r_AvailableSystemProperties&version=australia&pubname=australia-platform-administration&ft:locale=en-US).

## Fetch - fetch(String resource, Object options) {#ariaid-title2}

Starts the process of fetching a resource from the network and returns a promise that is fulfilled once the response is available.
{#fetch.fetch_S_O__table_arq_npb_jdc__entry__3}

| Name | Type | Description |
|-|-|-|
| resource | String or Object | Required. The resource to fetch. Accepted values: * A string or an object with a stringifier, including a URL object, that provides the URL of the resource you want to fetch. The URL may be relative to the base URL which is the document's baseURI. * A [Fetch Request - Request()](https://servicenow-prod.fluidtopics.net/W0gJkwIJSZxt9ZBuK47pfg#fetch.request-constructor "Creates a new Request object. Optionally create the Request object from a URL or object resource.") object. {#fetch.fetch_S_O__ul_lbz_kqb_jdc} |
| options | Object | Optional. A [Fetch RequestInit - Scoped, Global](https://servicenow-prod.fluidtopics.net/u~mCRUkZ0_odSqZr~o5F4A#Fetch.RequestInitAPI "The RequestInit API provides options to configure a Fetch request.") object containing custom settings to apply to the request. Default: The request is passed without any customization settings. |
[Table 1. Parameters]

{#fetch.fetch_S_O__table_arq_npb_jdc} {#fetch.fetch_S_O__table_brq_npb_jdc__entry__2}

| Type | Description |
|-|-|
| Object | A promise that resolves to a response object. A fetch() promise only rejects when the request fails, for example, because of a badly-formed request URL or a network error. Note: A fetch() promise is not considered as rejected if the server responds with HTTP status codes that indicate errors like 404 or 504. In this instance, use a then() handler to check the ok and status [Fetch Response - Scoped,Global](https://servicenow-prod.fluidtopics.net/dRaKslSlaxFBm4A0S5Hneg#Fetch.ResponseAPI "The Fetch Response API provides methods for creating a new Response object and for handling the response body created by a Fetch Request API method.")properties. |
[Table 2. Returns]

{#fetch.fetch_S_O__table_brq_npb_jdc}  
The following example demonstrates how to form a new Request object using [Fetch Request - Request()](https://servicenow-prod.fluidtopics.net/W0gJkwIJSZxt9ZBuK47pfg#fetch.request-constructor "Creates a new Request object. Optionally create the Request object from a URL or object resource.") and then fetch() to retrieve its data. Here is a simple explanation of how each part of the code is used:

* request(): Configures the API request with URL, method, and headers.
* fetch(): Makes the fetch request.
* response.json(): Parses the JSON response body into a JavaScript object. (See [Fetch Response - json()](https://servicenow-prod.fluidtopics.net/dRaKslSlaxFBm4A0S5Hneg#fetch.response-json "Returns a promise that resolves to the result of parsing the body text as JSON.") for more information.)
* console.log(): Outputs the incidents (data.result) using the Console API (See [Console - log(Object val1...val2, String msg, String subst1...subst2)](https://servicenow-prod.fluidtopics.net/R6VA~CcszVLKyESc6OKAdg#console-log_O_S_S "Logs a message to system logs.")).
{#fetch.fetch_S_O__ul_d4f_5br_c2c}

    async function fetchIncidents() {
        const url = 'https://your-instance.service-now.com/api/now/table/incident';
        const username = 'your_username';
        const password = 'your_password';

        // Create a Request object
        const request = new Request(url, {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
                Authorization: 'Basic ' + btoa(`${username}:${password}`)
            }
        });

        // Fetch data and use response.json() to process it
        const response = await fetch(request);
        const data = await response.json(); // Parse the response to JSON
        console.log(data.result); // Log the incidents data to system logs
    }

    fetchIncidents();

Output:

    [
        { "number": "INC0001", "short_description": "System outage" },
        { "number": "INC0002", "short_description": "Password reset request" }
    ]


