Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Retrieves a metadata template by its scope
and templateKey
values.
To find the scope
and templateKey
for a template, list all templates for
an enterprise or globally, or list all templates applied to a file or folder.
global
The scope of the metadata template
Value is one of global
,enterprise
properties
The name of the metadata template
Returns the metadata template matching the scope
and template
name.
Returned if any of the request parameters are not valid.
bad_request
: Often returned when the scope of the template is not
recognised. Please make sure to use either enterprise
or global
as
the scope
value.Returned when a template with the given scope
and template_key
can not
be found.
An unexpected client error.
curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise/blueprintTemplate/schema" \
-H "authorization: Bearer <ACCESS_TOKEN>"
await client.metadataTemplates.getMetadataTemplate(
'enterprise' as GetMetadataTemplateScope,
template.templateKey!,
);
client.metadata_templates.get_metadata_template(
GetMetadataTemplateScope.ENTERPRISE.value, template.template_key
)
await client.MetadataTemplates.GetMetadataTemplateAsync(scope: GetMetadataTemplateScope.Enterprise, templateKey: NullableUtils.Unwrap(template.TemplateKey));
try await client.metadataTemplates.getMetadataTemplate(scope: GetMetadataTemplateScope.enterprise, templateKey: template.templateKey!)
MetadataTemplate template = MetadataTemplate.getMetadataTemplate(api, "templateName");
template = client.metadata_template('enterprise', 'employeeRecord').get()
print(f'The {template.displayName} template has {len(template.fields)} fields')
BoxMetadataTemplate template = await client.MetadataManager
.GetMetadataTemplate("enterprise", "marketingCollateral");
client.metadata.getTemplateSchema('enterprise', 'vcontract')
.then(template => {
/* template -> {
id: '17f2d715-6acb-45f2-b96a-28b15efc9faa',
templateKey: 'vcontract',
scope: 'enterprise_12345',
displayName: 'Vendor Contract',
hidden: true,
fields:
[ { type: 'date',
key: 'signed',
displayName: 'Date Signed',
hidden: false },
{ type: 'string',
key: 'vendor',
displayName: 'Vendor',
hidden: false },
{ type: 'enum',
key: 'fy',
displayName: 'Fiscal Year',
options:
[ { key: 'FY17' },
{ key: 'FY18' },
{ key: 'FY19' } ],
hidden: false } ] }
*/
});
client.metadata.getTemplateByKey(
scope: "enterprise",
templateKey: "personnelRecord"
) { (result: Result<MetadataTemplate, BoxSDKError>) in
guard case let .success(template) = result {
print("Error retrieving metadata template")
return
}
print("Metadata template has \(template.fields?.count) fields")
}
{
"id": "58063d82-4128-7b43-bba9-92f706befcdf",
"type": "metadata_template",
"copyInstanceOnItemCopy": true,
"displayName": "Product Info",
"fields": [
{
"type": "string",
"key": "category",
"displayName": "Category",
"description": "The category",
"hidden": true,
"options": [
{
"key": "Category 1",
"id": "45dc2849-a4a7-40a9-a751-4a699a589190"
}
],
"id": "822227e0-47a5-921b-88a8-494760b2e6d2"
}
],
"hidden": true,
"scope": "enterprise_123456",
"templateKey": "productInfo"
}