Metadata that belongs to a file is grouped by templates. Templates allow the metadata service to provide a multitude of services, such as pre-defining sets of key:value pairs or schema enforcement on specific fields.
The getMetadataTemplate(BoxAPIConnection)
method will return information about default metadata schema.
Also getMetadataTemplate(BoxAPIConnection, String)
and getMetadataTemplate(BoxAPIConnection, String, String, String...)
can be used to set metadata template name, metadata scope and fields to retrieve.
MetadataTemplate template = MetadataTemplate.getMetadataTemplate(api, "templateName");
Calling the static getEnterpriseMetadataTemplates(BoxAPIConnection, String...)
will
return an iterable that will page through all metadata templates within a user's enterprise.
Also getEnterpriseMetadataTemplates(String, BoxAPIConnection, String...)
and getEnterpriseMetadataTemplates(String, int, BoxAPIConnection, String...)
can be used to set metadata scope, limit of items per single response.
Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates(BoxAPIConnection api);
for (MetadataTemplate templateInfo : templates) {
// Do something with the metadata template.
}