How to ad a coded value to Domain/Coded values in a hosted Feature Layer using REST API?

166
0
03-19-2024 08:15 AM
Labels (2)
Woodpeckerus
New Contributor III

I have a hosted Feature Layer in AGOL with several coded values/domain values in some of the fields. I want to use REST API to add or remove a domain value from the layer.

I believe updateDefinition endpoint is the one I'm after as I've successfully updated the domains values with a payload like this: 

{
  "fields": [
    {
      "name": "fieldName",
      "domain": {
        "type": "codedValue",
        "name": "domainName",
        "codedValues": [
          {
            "name": "Value 5",
            "code": "Value 5"
          }
        ]
      }
    }
  ]
}

 

So with the payload above, my updated list of coded values/domains is basically just [Value 5] as this will replace the whole domain list. 

Is there a way to 'append' coded value to the existing domain? My list of coded values looks like below and I just want to 'append' Value 5. 

        "codedValues": [
          {
            "name": "Value 1",
            "code": "Value 1"
          }, 
          {
            "name": "Value 2",
            "code": "Value 2"
          },
          {
            "name": "Value 3",
            "code": "Value 3"
          },
          {
            "name": "Value 4",
            "code": "Value 4"
          }
        ]

 

I don't think that's possible, or am I missing something?

 

0 Kudos
0 Replies