It look like publishing feature service from a .sd-file doesn't take into account publish_parameters provided as a parameter. If I use geodatabase instead, it seems to work as expected. I assume that this is a bug in the API but does someone know if there is workaround with .sd files? The idea behind the script is that we would like to publish different versions (ie. -dev, -qa) of the service as part of our DevOps pipeline from the same service. Geodatabases seems to work but it doesn't support symbology out of the box.
My test workflow here is very simple:
from arcgis.gis import GIS
import getpass
password = getpass.getpass("Enter password: ")
gis = GIS('organization', 'username', password)
print("Connected to: {}\nConnected as: {}".format(
gis.properties.urlKey + "." + gis.properties.customBaseUrl,
gis.users.me.username))
folder_name = 'GeoChatTest'
folder = gis.content.create_folder(folder=folder_name)
folder
uploaded_service_definition_item = gis.content.add(
item_properties={
'title' : 'GeoChat-ServiceDefinition',
'snippet' : 'Test service definition',
'description' : 'Test service that is created by using automation.',
'accessInformation' : '',
'licenseInfo' : 'For testing purposes only!',
'type' : 'Service Definition',
'tags' : ['chat','geochat'],
},
folder = folder_name,
thumbnail=r"./data/publishing_data/thumbnail_geochat.png",
data=r"./data/publishing_data/GeoChat.sd")
uploaded_service_definition_item
item_properties = {
'name' : 'GeoChatTest',
'description' : 'Test 1'
}
published_feature_service_item = uploaded_service_definition_item.publish(item_properties)
published_feature_service_item
item_properties = {
'name' : 'GeoChatTest2',
'description' : 'Test 2'
}
published_feature_service_item = uploaded_service_definition_item.publish(item_properties)
published_feature_service_item
What actually happens:
Atma Mani Andrew Chapkowski thoughts?