FRAMES | NO FRAMES
Using the Services Directory

This is an archive of a previous version of the ArcGIS REST API. The current version can be found at http://resources.arcgis.com/en/help/arcgis-rest-api/

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

Services Directory helps you do these things:

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 Services Directory, you navigate through a series of links to discover information about the server. Every 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 was retrieved through REST using the page's URL.

Browsing the server contents

When you open 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 what the service type is such as MapServer or GeocodeServer.

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

Click on 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 will 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, 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 choose to view the footprint of your server in Google Earth, a KMZ file opens that shows a KML place-mark for each available service. Clicking on the place-mark reveals more information about the service in a pop-up dialog.

Link for viewing footprints

If you choose to view footprints at the root level of the server, you will see services from the root level and all folders. Alternatively, you can view footprints at just the folder level.

You can use footprints to show what's on your server. You can use the Services Directory to discover the URL to your footprint. 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. Note that links to footprints are not available if services are secured using token based authentication.

Capturing the footprints URL

Viewing maps

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

Viewing options for map services

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 mentioned above. If you want a network link with properties or feature types other than the default, such as the vector feature type, you can use 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.

Note: 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. If you want to see vector features, choose the third option: "Vector layers as vectors and raster layers as images".

Generate KML panel

Note that the server administrator may have limited or disabled some of the options you might otherwise be able to set for your network link in 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

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 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 this:

http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer

How do you know how to construct this endpoint? If you are familiar with ArcGIS Server, you might be able to construct the endpoint from memory. But it's more likely that you would use Services Directory to help you discover the endpoint. Using 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.

Examples of how to use 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://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer");
myMap.addLayer(myTiledMapServiceLayer);

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

  1. Open a web browser to sampleserver1.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 Services Directory for a given GIS server.
  2. Click the maps folder link, then click the maps/world 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://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer/1");
. . .

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, "1") that tells which layer to get. The index comes from the position of the layer in the map's table of contents. Since you might not immediately know the index, you can use the Services Directory to find it.

To see how this works, return to Step 3 above. Before you copy the URL, look down at the information on the page about the "Portland" map service. You will see a clickable list of layers. Clicking on any layer gives you a new URL with the layer index that you can use inside your code.

Learning more about the REST API and Services Directory

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