Add a Column(field) to a feature service layer with Python API

133
0
3 weeks ago
Labels (2)
JO3
by
New Contributor

Hello! We have a feature service I would like to add a filed with the python api but I cant seem to figure out what the issue is. Any thoughts?

 

from arcgis import GIS
from arcgis import features



gis = GIS("https://****************/portal/home/", "****USER*******","******PASS******",  verify_cert=False, trust_env=True)


item = gis.content.get("43c08fc8fb0a4dda9f41f8dc3c202e2b")

layer = item.layers[1]

# Define the update
update_def = {
    'fields': [
        {'name': 'circuit_id',
         'type': 'esriFieldTypeSmallInteger',
         'alias': 'circuit_id',
         'domain': None,
         'editable': True,
         'nullable': True,
         'sqlType': 'sqlTypeInteger',
         'length': 10}
    ]
}

# Update the layer definition
res = layer.manager.add_to_definition(update_def)

# Print the result
print(res)

 

 

I get  the below error. But I am able to see properties of the layer and I am infect connected.

Exception: Unknown Error
(Error Code: 500)

 

0 Kudos
0 Replies