You are here

You are here

Finding Attribute Group and Field Configurations

Often times when working with the API the metadata groups and fields to be indexed or retrieved will be known at development time.  For the case when the groups and fields in an account need to be discovered dynamically at runtime, the API exposes the GetMetadataGroups and GetMetadataFields methods.  These methods can be used to determine what Attributes Groups exist in the account, and then what fields exist in those groups.  Attribute groups are returned as just the string name of the group, and fields are represented by the SCMMetadataField object that include not only the name, but additional data about the field such its datatype, if it is required or not, and set information.

Vertical Tabs

c#
string[] groupNames = springCMService.GetMetadataGroups(token);
foreach (string groupName in groupNames)
{
	Console.WriteLine("Listing the fields in group {0}",groupName);
 
	SCMMetadataField[] fields = springCMService.GetMetadataFields(token, groupName);
	foreach (var field in fields)
	{
		Console.WriteLine("Name: {0}, Datatype: {1}",field.Name,field.DataType);
	}
}
java
String[] groupNames = springCMService.getMetadataGroups(token);
for(String groupName : groupNames)
{
 System.out.format("Listing the fields in group %s\n",groupName);
 
 SCMMetadataField[] fields = springCMService.getMetadataFields(token, groupName);
 for(SCMMetadataField field : fields)
 {
	 System.out.format("Name: %s, Datatype: %s\n",field.getName(),field.getDataType());
 }
}