Skip To Content

Clear REST Cache

  • URL:https://<admin-url>/system/handlers/rest/cache/clear
  • Version Introduced:10.0

Description

Note:

At 10.1 and later, ArcGIS Server automatically updates the REST cache when you add, update, or remove services and folders. This eliminates the need for clearing the REST cache manually when a change is made to the services or folders.

However, if you need to clear the cache manually, use the clear cache operation supported by the ArcGIS Server Admin API using the https://<admin-url>/system/handlers/rest/cache/clear URL. Contact Esri Support if there are use cases that require manual clearing of the REST cache.

The Clear REST Cache operation explicitly clears the REST API cache immediately.

Clients need a security token to clear the REST cache. You can obtain a security token by using the Generate Admin Token operation.

The Clear REST Cache operation supports the following parameters. If the folderName, serviceName, and type parameters are not specified, the entire REST cache will be cleared.

Request parameters

ParameterDetails
f

Description: The response format. The default response format is html.

Values: html | json

folderName

Description: The name of a folder. If only the folderName parameter is specified in the request, the cache will be cleared for that folder.

Example: folderName=CachedServices

serviceName

Description: The service for which the REST cache needs to be cleared. When providing a serviceName, also provide the type parameter. If the folderName parameter is not set, the service is assumed to be in the root folder. The REST cache will be cleared for the specified service and its folder.

Example: serviceName=WorldElevation

type

Description: The type of service.

Example: type=MapServer

Example usage

Example 1: Use the security token generated using the Generate Admin Token operation to clear the REST cache. This will clear the entire REST cache.

https://<host>/arcgis/admin/system/handlers/rest/cache/clear?token=89dw7r0jfFDKWgDa7bZHVvttqiEv7sX7UnOH1oe_Mz-qqQ6oDg..&f=json

Example 2: Clear the cache for a specific service and its folder, for example, when a service is stopped.

https://<host>/arcgis/admin/system/handlers/rest/cache/clear?folderName=CachedServices&serviceName=WorldElevation&type=MapServer&token=89dw7r0jfFDKWgDa7bZHVvttqiEv7sX7UnOH1oe_Mz-qqQ6oDg..&f=json

Example 3: Clear a folder cache, for example, after a new service is created.

https://<host>/arcgis/admin/system/handlers/rest/cache/clear?folderName=CachedServices&token=89dw7r0jfFDKWgDa7bZHVvttqiEv7sX7UnOH1oe_Mz-qqQ6oDg..&f=json

Example 4: Clear a root folder's cache after a folder is added or removed.


https://<host>/arcgis/admin/system/handlers/rest/cache/clear?folderName=/&token=89dw7r0jfFDKWgDa7bZHVvttqiEv7sX7UnOH1oe_Mz-qqQ6oDg..&f=json

JSON Response syntax


            {
  "success": true //the value will always be true. Failure will result in an error response.
}

JSON Response example


            {
  "success": true
}