How To: Add coded value domains to a hosted feature service from a REST endpoint
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.
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.
- Log in to www.arcgis.com with administrator credentials.
- Click My Content, and navigate to the intended feature service. Open the feature service.
- In the item details page of the feature service, under Layers, click Service URL. The ArcGIS REST Administrator Directory page opens.
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).
- Modify the URL to the one displayed below, appending /admin between rest and services:
- Press Enter to access the new page.
- Scroll to the bottom of the page to see the Supported Operations list, and click Update Definition.
- 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.
- Change the lastEditDate key value to a set of quotation marks with no content quoted, " ",as demonstrated in the image below.
- Click Update Layer Definition to save the changes.
- 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.
- ArcGIS Blog: Updating Hosted Feature Services in ArcGIS Online
- ArcGIS Blog: Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python
- ArcGIS REST API: Update Definition (Feature Service)
- ArcGIS REST API: Update Definition (Feature Layer)
- FAQ: Is it possible to add or edit domains after a feature service is published in ArcGIS Online?