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!
<SPAN class="keyword token">import</SPAN> requests
data <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="string token">'username'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'my username here'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'password'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'my password here'</SPAN>
<SPAN class="punctuation token">}</SPAN>
requests<SPAN class="punctuation token">.</SPAN>post<SPAN class="punctuation token">(</SPAN>url<SPAN class="operator token">=</SPAN><SPAN class="string token">"http://mobjack.vims.edu:6080/arcgis/admin/services/VIMS_CCRM/test2.ImageServer/delete"</SPAN><SPAN class="punctuation token">,</SPAN> data<SPAN class="operator token">=</SPAN>data<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>