Using the Services Directory

The Services Directory allows you to browse the contents of an ArcGIS Server and obtain information that can be useful when developing applications. The Services Directory is a view of the ArcGIS Server REST API in HTML format. Each ArcGIS Server instance has the Services Directory installed during the installation process.

With the Services Directory, you can do the following:

The Services Directory works using REST. REST is an architectural style that allows ArcGIS Server to reveal a hierarchy of information about itself through endpoints, or URLs. When you use the Services Directory, you navigate through a series of links to discover information about the server. Each time you click a link, you see a new page that reveals additional information about what's available on the server. The information that you see on the page is retrieved through REST using the page's URL.

Browsing the server contents

When you open the Services Directory, you first see the home page, which lists all services in the root directory along with any folders containing additional services. In addition to the name of the service, you can see the service type, such as MapServer or GeocodeServer.

NoteNote:

The server administrator determines the folder structure. You cannot control this through the Services Directory.

Click a service name to get more information. The available information varies depending on the type of service. If you click a map service (MapServer), you'll see information such as layer names, document information, and supported interfaces. If you continue clicking through the levels of links, you can get information about the individual layers in the service. In this way, the Services Directory exposes a large amount of metadata for your services.

Viewing footprints of your server

A footprint is a geographic catalog of all your services. When you view the footprints of your server, it opens a feature collection in an ArcGIS Online map viewer showing a place-mark for each available service. Clicking the place-mark reveals more information about the service in a pop-up dialog box.

If you view footprints at the root level of the server, you'll see services from the root level. You can also view footprints at each folder level.

View footprint in ArcGIS Online map viewer

You can use footprints to show what's on your server. You can use the Services Directory to discover the URL to your footprint. Right-click the footprint link to copy the footprint URL. Then when you share the URL with others, they can always get the most up-to-date view of what's available on your server.

NoteNote:

ArcGIS Online map viewer supports the viewing of footprints only when the services are unsecured or when secured using token based authentication.

Viewing maps

When you publish a map service, you can get the contents in several different formats using the Services Directory. When you navigate to a map service's page, you'll see the option to View In different applications. These include the following:

Generating KML

All map and image services have a KML network link available that you can browse to using the View In: Google Earth link previously mentioned. If you want a network link with properties or feature types other than the default, such as the vector feature type, you can use the Services Directory to generate your own KML network link.

To generate your own KML network link, navigate to the page of the map service you want to view. From the Map Operations list, click the Generate KML link.

NoteNote:

The Generate KML link is not available if the server administrator has disabled the KML capability for the service. The link is also not available if services are secured using token based authentication.

Generate KML link

On this page, you can set some basic properties for your KML network link, including the name, the layers to include, and the layer drawing options. To see vector features, choose the third option, Vector layers as vectors and raster layers as images.

Generate KML panel
NoteNote:

The server administrator may have limited or disabled some of the options you might otherwise be able to set for your network link in the Services Directory. For example, the administrator may have disabled the ability for the server to return vector features, or the administrator may have set a limit on how many KML features the server can return.

Once you generate the network link, you can distribute it to others as needed. One advantage of distributing a network link instead of static KML is that the network link points to the KML capability on the map service. Referencing dynamic KML in this way ensures that you will always see the most up-to-date features.

Getting information for development

The Services Directory can help you get information that you need when developing JavaScript applications. The JavaScript APIs included with ArcGIS Server are based on REST, and every ArcGIS Server instance exposes its information through REST endpoints or URLs. Each endpoint returns some piece of information about the server or one of its services.

For example, using the ArcGIS Server JavaScript API, you can write some code that displays a map in a web browser. This code requires the REST endpoint of the map service, which might look something like the following:

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network_Base_Map/MapServer

How do you know how to construct this endpoint? If you're familiar with ArcGIS Server, you may be able to construct the endpoint from memory. But it's more likely that you'll use the Services Directory to help you discover the endpoint. Using the Services Directory, you can browse through the contents of your server until you reach the map service. You can then copy the URL out of the browser and paste it in your code.

Using the Services Directory in your development

The code to add a cached map to your application looks something like this:

myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer
 ("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network_Base_Map/MapServer");
myMap.addLayer(myTiledMapServiceLayer);

Notice the URL for the REST endpoint of the map service (sampleserver6.arcgisonline.com/arcgis...). If you did not know this URL, the following steps could help you discover it using the Services Directory:

Steps:
  1. Open a web browser to sampleserver6.arcgisonline.com/arcgis/rest/services. It's helpful to remember this URL pattern http://<server name>/<instance name>/rest/services, since this is how you open the Services Directory for a given GIS server.
  2. Click the Water_Network_Base_Map link, since this is the service whose URL you want to find.
  3. Copy the URL from the browser and paste it in your code.

Copy the URL from the browser

Sometimes you need to work with an individual layer in the map. For example, the code to set up a query on a layer starts like this:

function init() {
 //build query
 myQueryTask = new esri.tasks.QueryTask
  ("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Water_Network_Base_Map/MapServer/78");
. . .

The URL used in the code above looks a lot like the URL for the map, with the addition of an index (in this case, 78) that tells which layer to get. The index comes from the position of the layer in the map's table of contents. Since you may not immediately know the index, you can use the Services Directory to find it.

To see how this works, see step 3 above. Before you copy the URL, notice the information on the page about the Water_Network_Base_Map map service. You'll see a clickable list of layers. Clicking any layer gives you a new URL with the layer index that you can use inside your code.

Learn more about the REST API and the Services Directory

For more details about understanding the ArcGIS REST API and using the Services Directory to test URLs, see Getting started with the ArcGIS Server REST API.

3/3/2017