Hide Table of Contents
Get the ArcGIS API for JavaScript

The ArcGIS API for JavaScript is available to developers in several configurations. The manner in which you decide to consume the API may depend on how you intend to consume it. Some of the factors that may influence the consumption method are network access, application deployment, functionality, and optimization. The majority of developers and consumers of the JavaScript API will use the Content Delivery Network (CDN). The JavaScript API is hosted by Esri and is available for free use, please read the Terms of Use - FAQ for more info. Note: The code for the ArcGIS API for JavaScript cannot be modified. The remainder of this topic will cover the details related to the options in which you may obtain the API.

CDN (hosted version)

The recommended approach for accessing the API is to use the hosted version by adding the following script and link tags to your page:

<link rel="stylesheet" href="https://js.arcgis.com/3.22/esri/css/esri.css">
<script src="https://js.arcgis.com/3.22/"></script>

Benefits to working with the hosted version of the API:

  • Delivered via a content delivery network (CDN). CDN's are a collection of geographically distributed web servers that deliver content efficiently.
  • The servers are load balanced and monitored 24/7.
  • No need to download and re-install the API when new versions are released. You just need to modify the script tag in your application to point to the new version.

Web Optimizer

The ArcGIS API for JavaScript Web Optimizer is a web application that generates custom builds of the ArcGIS API for JavaScript. The advantage of using a custom build is that your application downloads and parses only the required JavaScript resources for your specific application, making your application load faster. Using the Web Optimizer at the end of your development cycle before releasing your application to production, is the preferred method for achieving a library tailored for your focused application. For more details on the web optimizer read the Using the Web Optimizer topic.

Using Bower for Custom Builds

Using Bower (A package manager for the front-end web development) is another option for developers of the JavaScript API to generate custom builds of the ArcGIS API for JavaScript. Some advanced scenarios require the ability to create custom builds of the JavaScript API locally. Many developers are already using Node.js build tools such as Grunt, Gulp, or npm (see: npm-run-script, npm-scripts) for solving automation workflow issues such as continuous integration. In addition, some developers just want to have more control over their build environment, and other developers have requirements to use other AMD loaders such RequireJS. For more information see the arcgis-js-api build tools topic in the jsapi-resources repo on GitHub, the blog article titled Using Bower for Custom Builds of the ArcGIS API for JavaScript, and read the Using Bower for Custom Builds topic.

Compact Build

The compact build of the ArcGIS API for JavaScript was the only choice for a smaller build before the availability of the Web Optimizer. The purpose of the compact build was to present developers and consumers of the JavaScript API with a subset of all the modules in the JavaScript API (based upon the most frequently used modules). It was designed for minimizing the number of modules an application had to download when building applications where slower connection speeds and network latency are an issue. For example, on a mobile device, where you want the smallest possible download. This build is also a great option if you want to use a JavaScript library other than Dojo.

Note: While the compact build is good choice for developers wanting a smaller initial library, it is recommended to create a custom build using the Web Optimizer once you are ready to deploy your application. It is for this reason that many developers may not have the same reliance on the compact build as they did before the Web Optimizer was available.

To use the compact build, add the following script tag to your application:

<script src="https://js.arcgis.com/3.22compact/">

Primary differences between compact build and standard build.

  1. The compact build removes the dependency on the dijit namespace upon initial download, meaning that if you don't need the dojo dijits they won't be loaded. A side-effect of this is that a new info window and slider are provided.
    InfoWindow and Navigation dijit
  2. The compact build includes less modules than the standard build. If your application requires objects from modules not included in the compact build you will need to load them using require(). For example, if you want to perform geoprocessing with the compact build you will need to add the following require() statement to your application.
    require(["esri/tasks/Geoprocessor", ... ], function(Geoprocessor, ... ){ ... });
    

These two features reduce the size of the build significantly. Less JavaScript code to execute means less work the browser has to do.

Download

In some cases, you may need to use a locally hosted version of the JavaScript API, for example, if you are in a restricted network environment with no internet access. You can also download and install the SDK which includes the Guide, API reference, Sample Code, and documentation. The SDK available for download is a snapshot of the help from the release date of the ArcGIS API for JavaScript version 3.22 and will not include sample updates, documentation fixes etc.

To download and install the ArcGIS API for JavaScript and SDK navigate to the ArcGIS API for JavaScript download page and log-in with your Esri global account.

Note: If you do not have access to the internet, contact Esri Customer Service to have a DVD mailed.