Update_Definition? Or Add_to_Definition?

1523
2
06-26-2017 05:48 AM
roialgavish
New Contributor III

Hello,

I am using the ArcGIS Rest APIs for a long time and I can't get to figure out what is the correct endpoint? And syntax? for adding a coded value to a domain. I have a list of around 5000 values in a domain and I am building a python script that will add one more code and value to that list, but I can't succeed.

So what I am asking is to use the Update_Definition? Or the Add_to_Definition? And if I can append a code and a value to the list or I need to post the all list? Did anyone have a success in doing so?

Thank you all,

Roi.

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Roi,

Since you are adding just one more coded domain and value, you may want to do this manually.  Take a look at the section Domains and their values on page 4:

https://blogs.esri.com/esri/arcgis/files/2014/10/How-to-Update-Hosted-Feature-Service-Schemas1.pdf 

0 Kudos
RandyBurton
MVP Alum

In addition to the PDF document Jake Skinner‌ mentioned, you can look at Example 6 on this page.

The Add to Definition is for adding new elements, such as a new field, to your feature service.  Since you are modifying an existing field, you will want to use the Update Definition option for the field (or all fields) that use the domain.  I suggest reading the JSON file, then select the field you wish to update and copy all of its information to a text file.  Then add the item to the domain list where you want it displayed.  Do not delete any items from the domain list as you will be updating the complete domain structure, and do not delete the field name (see Example 6).  Before updating, I suggest using something like jsonlint.com to verify the formatting of your update.

The endpoint will vary depending on whether you are using AGOL or your own server/portal.  I agree with Jake that you would probably want to do this manually rather than write a script.  Also, make a backup of your data before updating.

0 Kudos