I would like to script the process to clear the rest cache on the \rest\admin page after I do a start/stop with the AGSSOM.exe provided on arcscripts. Is it typical to have to clear the cache after creating new services or start/stop-ing services. We seem to have to. Thanks.
You can build the URL using these instructions on the ArcGIS Server Blog then simply call the URL from your script.
You should clear the cache if you create or remove a service. However you should not need to when you just start or stop a service. Here is the esri documentation:
You should need to clear the cache only if you are creating new services or altering existing ones. For example if you are starting and stopping a service because you have altered the underlying MXD or MSD you would need to clear the cache for those changes to take effect. This needs to be done even for seemingly minor changes such as enabling or disabling fields in the MXD.
However if you are restarting the service because you had a problem with it or you are shutting down the SOM and SOC because you are doing your compress and want to remove all database locks then it is not necessary because the REST service directory is not changing.
Ultimately, don't script the cache clearing process because it is not something you should have to do on a regular basis. You should do it manually as a part of the service creation/editing process.