English

How To: Add coded value domains to a hosted feature service from a REST endpoint

Summary

Note:
As of the June 2018 update to ArcGIS Online, domains can be added and updated directly in ArcGIS Online through the Data tab in the hosted feature layer's item page. For more details, refer to ArcGIS Online: Define attribute lists and ranges.

The instructions provided describe how to add coded value domains to a hosted feature service from the REST endpoint in ArcGIS Online. The instructions can also be applied in other instances, such as editing the values inside of a coded value domain for the feature service. 

Note:
Each layer may have to be opened to update the parameter if there are multiple layers in the service.

Procedure

Warning:  
The instructions below include making changes to essential parts of your hosted feature service. It is recommended that you make a copy of the original JSON before proceeding. 
 
Esri cannot guarantee results from incorrect modifications while following these instructions. Therefore, use caution and proceed at your own risk. Any problems encountered as a result of making these modifications are not supported by Esri Technical Support.
Note:
Ensure the feature service is not shared publicly before using this workflow.
  1. Log in to www.arcgis.com with administrator credentials.
  2. Click My Content, and navigate to the intended feature service. Open the feature service.
  3. In the item details page of the feature service, under Layers, click Service URL. The ArcGIS REST Administrator Directory page opens.

    Service URL button highlighted under the Layers section
Note:
If the error, "There are no services available" is returned when visiting the ArcGIS REST Administrator Directory, the hosted feature service is shared with 'Everyone' (public).
  1. Modify the URL to the one displayed below, appending /admin between rest and services:
http://services.arcgis.com/xxxxx/ArcGIS/rest/admin/services/states.FeatureServer/0 
  1. Press Enter to access the new page.
  2. Scroll to the bottom of the page to see the Supported Operations list, and click Update Definition.
  3. Search for the codedValue parameter (Press Ctrl + F, and search for codedvalue). To add coded value domains, copy and paste the JSON for the domains and change the details as desired.
Note:
It is also possible to update or change the order of domains for a feature service as desired using this step.
A fourth coded value (name: Green Ranger, code: Green) is inserted into the JSON.
  1. Change the lastEditDate key value to a set of quotation marks with no content quoted, " ",as demonstrated in the image below.

    Under editingInfo, the lastEditDate key is updated.
     
  2. Click Update Layer Definition to save the changes.

    The Update Layer Definition button is selected.
     
  3. Return to the My Content page and open the feature service in a new web map. The updated coded value domains are included and displayed in the attribute table.

    Updated coded value domains displayed in the attribute table.

Related Information