How to edit Feature Layer (hosted) Settings through ArcGIS API for Python

1817
5
03-15-2018 06:01 PM
NathanielEvatt
New Contributor III

I am trying to update settings on a feature layer that I have published from ArcPro.  It appears that I cannot set  "Keep track of created and updated features" or "Keep track of who created and last updated features." in Pro.  So I have to set these by hand in ArcGIS Online in the layer settings under "Feature Layer (hosted) Settings"

I have to do this for many layers, so it would be great to automate the process.  Is this possible in ArcGIS API for Python?

Tags (1)
0 Kudos
5 Replies
by Anonymous User
Not applicable

You can perform an `update_definition` operation to set these properties. You can refer here for an example: Service definitions | ArcGIS for Developers 

NathanielEvatt
New Contributor III

Thanks Atma. 

Very useful.  I was able to change the "Keep track of who created and last updated features." value with the 'update_definition' call on "enableEditorTracking".  However, the properties don't seem to change at all whether "Keep track of created and updated features." is checked or not.  Do you know if this property does anything?  Is it connected to "enableEditorTracking"?

Thanks,

Nat

0 Kudos
by Anonymous User
Not applicable

I don't quite understand what you said. In case you meant: "the web app, will check or uncheck a group of options if one is checked, but the Python API does not do that", then yes, you should expect this. The web app has client side logic to do this. The Python API on the other hand leaves it to you to update the definition of related properties. If you try to perform an unsupported operation, the server will reject it and respond with an error.

0 Kudos
WengNg1
New Contributor III

Hi,

I'm attempting to do the same thing through ArcGIS Python API. I succeeded in changing the 'Keep track of who created and last updated features' through an update definition call using the API. 

However, I was unable to locate the property that defines Keep track of created and updated features . 

What should I do to enable that property?

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

To get the option ticked in the AGOL interface, "ChangeTracking" needs to be added in the capabilities.

update_dict={"capabilities": "Query,ChangeTracking"}
flc.manager.update_definition(update_dict)‍‍

Please be aware that python API is only a wrapper around the REST API, to find the full list of properties supported, you need look into the REST API document which gives you a better chance, it's not guaranteed that you will find all the properties corresponding to the options on the AGOL interface.

According to ESRI document, "If the property does not exist, it's equivalent to having a value of false or not set."

Hope this helps.

0 Kudos