Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 2.86 KB

metadata_template.md

File metadata and controls

41 lines (29 loc) · 2.86 KB

Metadata Templates

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.

Get Metadata Template

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");

Get Enterprise Metadata Templates

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.
}