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 ArcMap 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 API for Python
You can leverage the gis.admin module of ArcGIS API for Python to assist with and automate administrative tasks in ArcGIS Server. Among these tasks are checking the status of servers, resetting passwords, and federating or unfederating a server from an ArcGIS Enterprise portal.
Learn more about ArcGIS API for Python
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 an ArcGIS Server site. 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.