Enterprise Data Catalog REST API Reference > Use Cases > Retrieve Attribute Details for a Class
  

Retrieve Attribute Details for a Class

The sample use case is to retrieve the attribute details of a class and all the included sub classes.
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 void getAttributesForClassDataElement() throws ApiException {
final String classId = "core.DataElement";

AttributesResponse response = null;
List<String> attributeNames = new ArrayList<>();
int offset = 0;
do {
response = this.api.catalogModelsAttributesGet(null,
new ArrayList<>(Arrays.asList(classId)),
new BigDecimal(offset),
new BigDecimal(20));

// Increment offset to fetch next page
offset += 20;

for (AttributeResponse attr : response.getItems()) {
attributeNames.add(attr.getName());
}

// If there are more than 20 results, you can do a loop operation to fetch all the results
} while (offset < response.getMetadata().getTotalCount().intValue());
}
}

}
Using Curl
curl -X GET --header "Accept: application/json" "http://localhost:13000/2/catalog/models/attributes?classId=core.DataElement&offset=0&pageSize=20"