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

Create Custom Attribute

The sample use case is to create a custom attribute with the with the following properties:
You can use the REST API and create the custom reference attribute in one of the following ways:
Using Java code and the Bundled Java Client
public String createRegionCustomAttribute() throws ApiException {
AttributesRequest attributes = new AttributesRequest()
.addItemsItem(new AttributePostRequest()
.name("Region")
.dataTypeId("core.String")
.boost(AttributePostRequest.BoostEnum.MEDIUM)
.multivalued(true)
.searchable(true)
.sortable(true)
.suggestable(true));
AttributesResponse response = this.api.catalogModelsAttributesPost(attributes);
AttributeResponse createdAttribute = response.getItems().get(0);
// Unique id is created by the system
return createdAttribute.getId();
}
}

}
Using Curl
curl -X POST --header "Accept: application/json" --header "Content-Type: application/json" -d "{
\"items\": [
{
\"boost\": \"MEDIUM\",
\"name\": \"Region\",
\"dataTypeId\": \"core.String\",
\"multivalued\": true,
\"suggestable\": true,
\"sortable\": true,
\"searchable\": true,
\"facetable\": false,
\"classes\": []
}
]
}" "http://localhost:13000/2/catalog/models/attributes