Deleting a service definition

2045
3
09-16-2016 02:47 PM
CynthiaKozma
Occasional Contributor II

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.  

Tags (1)
0 Kudos
3 Replies
KellyGerrow
Esri Frequent Contributor

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

0 Kudos
CynthiaKozma
Occasional Contributor II

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

0 Kudos