Scripting ArcGIS Server administration
ArcGIS Server exposes its functionality through web services, therefore you can administer the server using the ArcGIS REST API. Scripting your server administration allows you to automatically execute common tasks at scheduled times. It also reduces the chance of making mistakes when performing a complicated or repetitive task.
The ArcGIS Server command line utilities and the ArcPy site package provide an additional variety of options for scripting server administration. Each is described below.
The ArcGIS REST API and its relationship to ArcGIS Server
The ArcGIS REST API allows you to work with the ArcGIS platform through web services. The REST API includes resources and operations for administering an ArcGIS Server site. Through the REST API, you can invoke every administrative task that ArcGIS Server supports. In fact, all administration tools provided with ArcGIS, including ArcGIS for Desktop and ArcGIS Server Manager, make use of this API.
Here's a sample of the many server administration tasks that you can do programmatically through the REST API:
- Create a site after installing ArcGIS Server silently
- Add services
- Edit properties of services such as the maximum number of instances
- Grant and revoke user permissions on services
- Stop and start services
- Query the logs and create usage reports from them
ArcGIS Server command line utilities
ArcGIS Server includes some scriptable utilities that allow you to administer the server from batch files or the operating system command line. For basic actions such as starting services and building caches, using these utilities may be easier than writing a script from scratch.
ArcPy functions for publishing services and registering data locations
The ArcPy Python site package offers functions for publishing services to ArcGIS Server, working with service definition (SD) files, and registering folders and databases with ArcGIS Server. ArcPy can be used to script administrative tasks involving service publishing. It can also analyze map documents and report errors and warnings related to the map's use with ArcGIS Server.