Delete service using Python POST request

442
0
10-18-2019 08:01 AM
DanielSchatt
New Contributor III

I'm using Python 2.7 with a stand-alone server running ArcGIS Server 10.7. I would like to be able to delete an image service in my Python code and I saw that one can do this with a POST request to the ArcGIS REST API. I've never used this before so I'm not familiar with the syntax. I'm trying the code below to delete an image service "test2" - it runs successfully but the service is not deleted. However I can delete the service manually. Does anyone know why the code doesn't work? Thanks!

import requests

data = {
    'username': 'my username here',
    'password': 'my password here'
    }
requests.post(url="http://mobjack.vims.edu:6080/arcgis/admin/services/VIMS_CCRM/test2.ImageServer/delete", data=data)
0 Kudos
0 Replies