Select to view content in your preferred language

How can I create a service in a folder other than root.

421
1
04-17-2018 07:49 AM
KaiSteinicke1
Esri Contributor

Hi,

 When I create a service it always gets created in the root directory.

target_server = arcgis.gis.server.Server(server_url, username=username, password=password)
result = target_server.services.create_service(json.dumps(service_dict))‍‍‍‍‍‍‍‍‍

This actually works, but uses "_con" attribute.

folder_service_manager = arcgis.gis.server.ServiceManager(target_server.services.url+'/'+service_folder,
 gis=target_server._con)‍‍‍‍
result = folder_service_manager.create_service(json.dumps(service_dict))‍‍‍

Is there a better way to do this, like changing the current folder?

Thanks,

Kai

0 Kudos
1 Reply
NicolasDechamps1
Emerging Contributor

Hi!

Is there any update on how to set the folder or the ServiceManager? For a standalone, unfedereated AGS, I cannot pass gis to a manually created.

I tried several things on my ServiceManager Object:

 

ags.services._folder(folder='temp')

or

ags.services._currentURL = ags.services._url + '/temp'
ags.services._init()

0 Kudos