I am writing a python script that will update a service definition in ArcGIS Online - to synchronize changes made by Desktop users. One question/answer that I found suggested 'deleting a service before publishing a replacement service, rather than overwriting'. I can't seem to find the right syntax to delete the old service definition. I'm assuming it uses ArcRest, but I can't seem to figure out how to code this. Any help would be appreciated. I am new to using ArcRest.
Hi Cynthia,
Are you trying to delete the Service Definition or the Hosted Feature Service? Can you share the error message that you are receiving?
-Kelly
Hi Kelly,
I have a python script that takes an MXD and creates a service definition from it. Then using arcpy.UploadServiceDefinition_server, it is supposed to overwrite the service definition on our ArcGIS Online site. The script runs on our server that has ArcGIS 10.4. I have looked and haven't had any success in finding a way to have my python script delete the current service definition and hosted feature service in our content. I had read that this was a more efficient way of updating rather than relying on the overwrite. I currently do not have anything in my script to do this --- so no errors. Is there a way to delete what is currently sitting in our AGOL before the script runs this.....???
arcpy.UploadServiceDefinition_server(UploadSD, My_Hosted_Services, "", "", "FROM_SERVICE_DEFINITION", "", "STARTED", "OVERRIDE_DEFINITION", "SHARE_ONLINE", "PUBLIC", "SHARE_ORGANIZATION","")
-Cindy