import request from "@arcgis/core/request.js";const request = await $arcgis.import("@arcgis/core/request.js");- Since
- ArcGIS Maps SDK for JavaScript 4.0
Retrieves data from a remote server or uploads a file.
Example
// request GeoJson data from USGS remote serverlet 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
| Name | Return Type | Object |
|---|---|---|
| |
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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.