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
curl -i -X GET "https://api.box.com/2.0/metadata_templates/global" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
Java
Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates('global', api);
for (MetadataTemplate templateInfo : templates) {
    // Do something with the metadata template.
}
Python
templates = client.get_metadata_templates(scope='global)
for template in templates:
    print('Metadata template {0} is in global scope'.format(template.templateKey))
iOS
let iterator = client.metadata.listEnterpriseTemplates(scope: "global")
iterator.next { results in
    switch results {
    case let .success(page):
        for template in page.entries {
            print("Template name: \(template.displayName)")
        }

    case let .failure(error):
        print(error)
    }
}

This API returns a list of all the metadata templates created by Box and made available to all enterprises.

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
curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
Java
Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates(api);
for (MetadataTemplate templateInfo : templates) {
    // Do something with the metadata template.
}
Python
templates = client.get_metadata_templates()
for template in templates:
    print('Metadata template {0} is in enterprise scope'.format(template.templateKey))
iOS
let iterator = client.metadata.listEnterpriseTemplates(scope: "enterprise")
iterator.next { results in
    switch results {
    case let .success(page):
        for template in page.entries {
            print("Template name: \(template.displayName)")
        }

    case let .failure(error):
        print(error)
    }
}

This API returns a list of all the metadata templates created by this enterprise, and these templates are only available to apply to files in this enterprise.

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.