List all metadata templates
List all metadata templates
Metadata templates can be listed for either the enterprise or the global scope.
List global templates
To list all global metadata templates, call the GET /metadata_templates/global API endpoint.
curl -i -X GET "https://api.box.com/2.0/metadata_templates/global" \
-H "authorization: Bearer <ACCESS_TOKEN>"await client.metadataTemplates.getGlobalMetadataTemplates();client.metadata_templates.get_global_metadata_templates()await client.MetadataTemplates.GetGlobalMetadataTemplatesAsync();try await client.metadataTemplates.getGlobalMetadataTemplates()client.getMetadataTemplates().getGlobalMetadataTemplates()Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates('global', api);
for (MetadataTemplate templateInfo : templates) {
// Do something with the metadata template.
}templates = client.get_metadata_templates(scope='global)
for template in templates:
print(f'Metadata template {template.templateKey} is in global scope')BoxEnterpriseMetadataTemplateCollection<BoxMetadataTemplate> templates = await client.MetadataManager
.GetEnterpriseMetadataAsync("global");client.metadata.getTemplates('global')
.then(templates => {
// ...
});List current enterprise's templates
To list all metadata templates created for usage within the current
enterprise, call the GET /metadata_templates/enterprise API
endpoint.
curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise" \
-H "authorization: Bearer <ACCESS_TOKEN>"await client.metadataTemplates.getEnterpriseMetadataTemplates();client.metadata_templates.get_enterprise_metadata_templates()await client.MetadataTemplates.GetEnterpriseMetadataTemplatesAsync();try await client.metadataTemplates.getEnterpriseMetadataTemplates()client.getMetadataTemplates().getEnterpriseMetadataTemplates()Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates(api);
for (MetadataTemplate templateInfo : templates) {
// Do something with the metadata template.
}templates = client.get_metadata_templates()
for template in templates:
print(f'Metadata template {template.templateKey} is in enterprise scope')BoxEnterpriseMetadataTemplateCollection<BoxMetadataTemplate> templates = await client.MetadataManager
.GetEnterpriseMetadataAsync();client.metadata.getTemplates('enterprise')
.then(templates => {
/* templates -> {
limit: 100,
entries:
[ { templateKey: 'documentFlow',
scope: 'enterprise_12345',
displayName: 'Document Flow',
hidden: false,
fields:
[ { type: 'string',
key: 'currentDocumentStage',
displayName: 'Current Document Stage',
hidden: false }
{ type: 'string',
key: 'needsApprovalFrom',
displayName: 'Needs Approval From',
hidden: false },
{ type: 'string',
key: 'nextDocumentStage',
displayName: 'Next Document Stage',
hidden: false }
{ type: 'float',
key: 'maximumDaysAllowedInCurrentStage',
displayName: 'Maximum Days Allowed In Current Stage',
hidden: false }
{ templateKey: 'marketingCollateral',
scope: 'enterprise_12345',
displayName: 'Marketing Collateral',
hidden: false,
fields:
[ { type: 'string',
key: 'audience1',
displayName: 'Audience',
hidden: false },
{ type: 'string',
key: 'previousState',
displayName: 'Previous State',
hidden: false } ] },
{ templateKey: 'productInfo',
scope: 'enterprise_12345',
displayName: 'Product Info',
hidden: false,
fields:
[ { type: 'float',
key: 'skuNumber',
displayName: 'SKU Number',
hidden: false },
{ type: 'enum',
key: 'department',
displayName: 'Department',
hidden: false,
options:
[ { key: 'Beauty' },
{ key: 'Shoes' },
{ key: 'Accessories' },
{ key: 'Clothing' },
{ key: 'Handbags' },
{ key: 'Bedding' },
{ key: 'Watches' } ] },
{ type: 'date',
key: 'displayDate',
displayName: 'Display Date',
hidden: false } ] } ],
next_marker: null,
prev_marker: null }
*/
});Pagination
This API uses marker-based pagination and can return a
next_marker value in the response body to indicate that more templates might
be available.