Can you set a field as unique using the arcgis rest api for python?
MartinPeak_0-1716263353621.png
Solved! Go to Solution.
You can, enabling unique values means adding an index with a unique constraint to the field. To do this in the API you'll want to call the FeatureLayerManager's add_to_definition() function, passing in something like this:
{"indexes":[
{"fields":"MyField",
"isUnique":True,
"description":"For uniqueness"}
]}
You can, enabling unique values means adding an index with a unique constraint to the field. To do this in the API you'll want to call the FeatureLayerManager's add_to_definition() function, passing in something like this:
{"indexes":[
{"fields":"MyField",
"isUnique":True,
"description":"For uniqueness"}
]}
thanks that works - this is the code: