Skip to content
import request from "@arcgis/core/request.js";
Since
ArcGIS Maps SDK for JavaScript 4.0

Retrieves data from a remote server or uploads a file.

See also
Example
// request GeoJson data from USGS remote server
let url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.geojson";
esriRequest(url, {
responseType: "json"
}).then((response) => {
// The requested data
let geoJson = response.data;
});

Functions

NameReturn TypeObject

request

Function
Type parameters
<T = any>

Retrieves data from a remote server or uploads a file from a user's computer. If the request returns an Error, the error object will include the details specified in RequestErrorDetails.

Signature
request <T = any>(url: string | URL, options?: RequestOptions): Promise<RequestResponse<T>>
Parameters
ParameterTypeDescriptionRequired
url

The request URL.

options

The options specified by the user in the data request. See RequestOptions for available properties.

Returns
Promise<RequestResponse>

Returns a promise that resolves to an object with the RequestResponse specification. If the request returns an Error, the error object will include the details specified in RequestErrorDetails.