ArcGIS REST JS

ArcGIS REST JS is a collection of JavaScript modules for accessing location services, ArcGIS Online and ArcGIS Enterprise REST APIs.

Audience: Developers building mapping, location-based, and spatial analysis solutions.

Layers

Learn how to work with feature layers and feature services.

Geocode and search

Learn how to find addresses, businesses, and places with the geocoding service.

Route and directions

Learn how to find a route and directions and service areas with the routing service.

Demographic data

Learn how to get demographic data with the GeoEnrichment service.

Get started

To start building applications with location services, you need an account and an API key.

1. Sign in with your ArcGIS account

Access the developer dashboard and tools you need to start building applications.

Get a free developer account

2. Start with an API key

The ArcGIS Platform supports different authentication methods. You can use an API key or OAuth 2.0 access token; we recommend starting with an API key. Learn more in Security and authentication.

Get an API key

3. Quick start

Below is a simple example that shows the results of a request to obtain layer metadata. To access layer data:

  1. Open the code in .
  2. Replace the apiKey with your API key from the dashboard.
CDNES ModulesNode JS
                                                
Change line
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>ArcGIS REST JS</title>
  <style>
    body {
      font-family: monospace;
      color: white;
      overflow: auto;
      padding: 1rem;
    body,pre{
      background: #000000;
  </style>
</head>
<body>
  <pre id="result"></pre>

  <!-- require ArcGIS REST JS libraries from https://unpkg.com -->
  <script src="https://unpkg.com/@esri/arcgis-rest-request@3.0.0/dist/umd/request.umd.js"></script>
  <script src="https://unpkg.com/@esri/arcgis-rest-auth@3.0.0/dist/umd/auth.umd.js"></script>
  <script>
    /* when including ArcGIS REST JS all exports are available
    from the same arcgisRest global */

    const apiKey = "YOUR_API_KEY";

    const authentication = new arcgisRest.ApiKey({
      key: apiKey
    });

    arcgisRest.request("https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads_Styled/FeatureServer/0", {
      authentication
    })
      .then(response => {
        console.log(response);
        document.getElementById("result").textContent = JSON.stringify(response, null, 2);
      });

  </script>

</body>
</html>

Result

4. Tutorials

Follow step-by-step tutorials to learn more about how to integrate ArcGIS REST JS with other location services.

See all tutorials

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.