Is it possible to set for example Capabilities for a running specific map service through the arcpy Python API? I searched for methods that can help me with this but can't find anything.
Let's say I want to activate WMS för a specific service. Then I want to make a call to the server and activate that setting. And then restart the service.
I have managed to publish, stop, start, remove services via arcpy but now I want to make changes in the configuration but can't figure out how.
Solved! Go to Solution.
Hello,
I don't think there is any way to change service properties (e.g. instances, caching properties, pooling) through either arcpy or the ArcGIS API for Python. The only way that I have ever come across before using Python is the REST API, through urllib and JSON calls.
Here is an example of how to edit service properties using Python in the REST API: https://enterprise.arcgis.com/en/server/latest/administer/windows/example-edit-service-properties.ht...
Hope this helps!
-Calvin
Not to get picky on semantics, but there is ArcPy and ArcGIS API for Python. It isn't clear which API you are referring to with "arcpy Python API." In general, ArcPy does little to nothing to manage ArcGIS Enterprise and GIS services, which is part of the whole reason ArcGIS API for Python was created.
Are you connecting to stand-alone ArcGIS Server or federated ArcGIS Server?
I'm connecting to a stand-alone ArcGIS Server. Also didn't know there where two versions of python API. The way I use it is by, in the Python file, import arcpy. Then I just use the functionality that is inside.
I use methods like:
arcpy.UploadServiceDefinition_server
arcpy.CreateRasterDataset_management
arcpy.gp.Combine_sa
if that says anything?
It looks like you are only using ArcPy, which does not have the ability to configure GIS services on a GIS Server. You can use the ArcGIS API for Python to configure GIS services on a GIS Server since it is first and foremost a Python wrapper for the ArcGIS REST API.
I would show you some mock-up code, but a defect was introduced in ArcGIS API for Python 1.8.0 that prevents my usual code from working. Supposedly a fix will be released with 1.8.3.
I don't recommend investing too much time or effort in the Python code examples that Esri has within the ArcGIS Enterprise documentation because a vast majority of them were created a long time ago before the ArcGIS API for Python existed. Many or all of those code samples work, if you really need to get something working now, but learning and using the ArcGIS API for Python is a better use of time and effort.
Hello,
I don't think there is any way to change service properties (e.g. instances, caching properties, pooling) through either arcpy or the ArcGIS API for Python. The only way that I have ever come across before using Python is the REST API, through urllib and JSON calls.
Here is an example of how to edit service properties using Python in the REST API: https://enterprise.arcgis.com/en/server/latest/administer/windows/example-edit-service-properties.ht...
Hope this helps!
-Calvin
Many thanks! That seems reasonable. I will try that solution.
Hi again!
That worked perfect. Many thanks! Do know about security settings for a service? I didn't get those settings in the REST reply. Do you know if there another REST call to get /set roles permitted to a certain service? I've looked around to all examples but can't figure out which one to use.
-Anders