ArcGIS REST JS

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

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 access the services, you need an developer account and an API key from your dashboard.

1. Sign up for a free developer account

Create a free account

2. Get an API key

Sign in to your developer dashboard

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
                                                
<!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;
    }
    pre {
      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