Changing Map Service Properties with Python

441
6
Jump to solution
04-09-2019 04:51 AM
deleted-user-AAb7-r4fhb6g
New Contributor III

Hello,

how can I change map service "Service Description" with Python? I would like to avoind changing the Service Description in arcgis/manager manually or republishing the map services.

Changing the "description" properties with Python via the admin route didn't take any effect what so ever. I assume these properties are not supposed to be linked to each other?

Thanks for any help.

Monika

0 Kudos
1 Solution

Accepted Solutions
deleted-user-AAb7-r4fhb6g
New Contributor III

Hi Jake Skinner‌,

Thank you for your suggestion.

But my services are map services published to federated ArcGIS Server. I want to change the properties of the actual map service (e.g. https://myURL/arcgis/rest/service/folder/mapServiceName/MapServer), not the properties of the portal item associated with that map service.

Thanks,

Monika

View solution in original post

0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Monika,

You can do this using the ArcGIS API for Python.  Here is an example of what you are trying to do:

Service definitions | ArcGIS for Developers 

0 Kudos
deleted-user-AAb7-r4fhb6g
New Contributor III

Hi Jake Skinner‌,

Thank you for your suggestion.

But my services are map services published to federated ArcGIS Server. I want to change the properties of the actual map service (e.g. https://myURL/arcgis/rest/service/folder/mapServiceName/MapServer), not the properties of the portal item associated with that map service.

Thanks,

Monika

View solution in original post

0 Kudos
JonathanQuinn
Esri Frequent Contributor

I believe the description is defined in the original MXD used to author the map service. You may need to update it there are overwrite the existing service.

0 Kudos
deleted-user-AAb7-r4fhb6g
New Contributor III

Hi Jonathan Quinn‌,

thanks for your suggestion. However, I'd like to avoid republishing the map services (either with a script or manually). I was hoping that I could edit (with python) the Service Description only.

0 Kudos
deleted-user-AAb7-r4fhb6g
New Contributor III

Hi,

I made the changes using python - manipulating the json object behind iteminfo:

https://developers.arcgis.com/rest/enterprise-administration/server/edititeminfo.htm

https://server:port/arcgis/admin/services/[<folder>]/<serviceName.serviceType>/iteminfo/edit

I am not sure whether the documentation is correct thought. I had to use serviceItemInfo instead of iteminfo?

https://server:port/arcgis/admin/services/Maps/MyMap.MapServer/iteminfo/edit iteminfo={

Each service required a restart for the change to be appear in the map service REST URL.

Thanks, Monika

adrianakbari
New Contributor II

The documentation on the site (https://developers.arcgis.com/rest/enterprise-administration/server/edititeminfo.htm) is not correct. In your script instead of iteminfo you need to use serviceiteminfo.

        editSvcURL = "/arcgis/admin/services/" + service + "/iteminfo/edit"
        params = urllib.parse.urlencode({'token': token, 'f''json''serviceItemInfo': updatedSvcJson})
        httpsConn.request("POST", editSvcURL, params, headers)
0 Kudos