AnsweredAssumed Answered

Python API: FeatureLayerCollection Manager, add_to_definition and the json_dict

Question asked by John.Evans on Jul 22, 2019
Latest reply on Oct 2, 2019 by WightmanAssoc

I am having trouble determining the proper way to use add_to_definition:


A sample js dict seems to be here:


This may end up me not being able to determine the appropriate workflow. When I used ArcGIS Pro to publish my feature service the first time, the feature layers were published under one service definition (Map):


Service Definition


Feature Service

I am able to update layers using layer.edit_features, and remove them using featureLayerCollection.manager.delete_from_definition(json_delete_dict).


What I am trying to do is write a json_dict directly to the 'Map' Service Definition. I don't want to publish something separately via item.publish (unless I'm supposed to?):


I want to directly 'append', for lack of a better word, the layer to the service definition in the same way the other layers and data were published the first time:


Service Definition Layer


Is it possible to directly add a layer to a service definition without publishing the item first? Am I off base? If I'm not even close, can someone walk me through the steps to add a layer to a service definition? Is there sample code anywhere (specifically a python add_to_definition json dict)?


Appreciate any and all insight.