Enterprise Data Catalog REST API Reference > Use Cases > Update Custom Attribute
  

Update Custom Attribute

The sample use case is to search for a custom attribute by the name Region that needs to be updated with the following properties:
You can use the REST API and update the custom attribute in one of the following ways:
Using Java code and the Bundled Java Client
public void updateRegionCustomAttribute(String regionAttributeId) throws ApiException {
// Fetch attribute to be updated
ApiResponse<AttributeResponse> httpResponse = this.api.catalogModelsAttributesIdGetWithHttpInfo(
regionAttributeId);
// ETag ensures there are no conflicting edits
String etag = httpResponse.getHeaders().get("ETag").get(0);
AttributeResponse attrResponse = httpResponse.getData();
// Copy the response into a request so that you can modify the request.
AttributePutRequest attrRequest = ObjectAdapter.INSTANCE.copyIntoAttributePutRequest(attrResponse);
attrRequest.boost(AttributePutRequest.BoostEnum.HIGH);
attrRequest.addClassesItem(new ModelRefRequest().id("core.DataElement"));
attrRequest.facetable(true);
attrRequest.description("Custom attribute to search for locations based on ZIP code.");
this.api.catalogModelsAttributesIdPut(regionAttributeId, attrRequest, etag);
}

}
Using Curl
// Fetch attribute to be updated
curl -X GET --header "Accept: application/json" "http://localhost:13000/2/catalog/models/attributes/com.infa.appmodels.ldm.LDM_a496a2d3_0c07_47e6_a941_fe081ff90f01"
// Send request to update
curl -X PUT --header "If-Match: 49590122486d7e1d2a726f4ff1bf3276" --header "Accept: application/json" --header "Content-Type: application/json" -d "{
\"boost\": \"HIGH\",
\"name\": \"Region\",
\"facetable\": true,
\"description\": \"Custom attribute to search for locations based on ZIP code.\",
\"classes\": [
{
\"id\": \"core.DataElement\"
}
]
}" "http://localhost:13000/2/catalog/models/attributes/com.infa.appmodels.ldm.LDM_a496a2d3_0c07_47e6_a941_fe081ff90f01"