Finds a metadata template by searching for the ID of an instance of the template.
This operation is performed by calling function getMetadataTemplatesByInstanceId.
See the endpoint docs at API Reference.
await client.metadataTemplates.getMetadataTemplatesByInstanceId({
metadataInstanceId: createdMetadataInstance.id!,
} satisfies GetMetadataTemplatesByInstanceIdQueryParams);
GetMetadataTemplatesByInstanceIdQueryParams
GetMetadataTemplatesByInstanceIdOptionalsInputThis function returns a value of type MetadataTemplates.
Returns a list containing the 1 metadata template that matches the instance ID.
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.
This operation is performed by calling function getMetadataTemplate.
See the endpoint docs at API Reference.
await client.metadataTemplates.getMetadataTemplate(
'enterprise' as GetMetadataTemplateScope,
template.templateKey!,
);
GetMetadataTemplateScope
string
GetMetadataTemplateOptionalsInputThis function returns a value of type MetadataTemplate.
Returns the metadata template matching the scope
and template name.
Updates a metadata template.
The metadata template can only be updated if the template already exists.
The update is applied atomically. If any errors occur during the application of the operations, the metadata template will not be changed.
This operation is performed by calling function updateMetadataTemplate.
See the endpoint docs at API Reference.
await client.metadataTemplates.updateMetadataTemplate(
'enterprise' as UpdateMetadataTemplateScope,
templateKey,
[
{
op: 'addField' as UpdateMetadataTemplateRequestBodyOpField,
fieldKey: 'newfieldname',
data: { ['type']: 'string', ['displayName']: 'newFieldName' },
} satisfies UpdateMetadataTemplateRequestBody,
],
);
UpdateMetadataTemplateScope
string
readonly UpdateMetadataTemplateRequestBody[]
UpdateMetadataTemplateOptionalsInputThis function returns a value of type MetadataTemplate.
Returns the updated metadata template, with the custom template data included.
Delete a metadata template and its instances. This deletion is permanent and can not be reversed.
This operation is performed by calling function deleteMetadataTemplate.
See the endpoint docs at API Reference.
await client.metadataTemplates.deleteMetadataTemplate(
'enterprise' as DeleteMetadataTemplateScope,
template.templateKey!,
);
DeleteMetadataTemplateScope
string
DeleteMetadataTemplateOptionalsInputThis function returns a value of type undefined.
Returns an empty response when the metadata template is successfully deleted.
Retrieves a metadata template by its ID.
This operation is performed by calling function getMetadataTemplateById.
See the endpoint docs at API Reference.
await client.metadataTemplates.getMetadataTemplateById(template.id);
string
GetMetadataTemplateByIdOptionalsInputThis function returns a value of type MetadataTemplate.
Returns the metadata template that matches the ID.
Used to retrieve all generic, global metadata templates available to all enterprises using Box.
This operation is performed by calling function getGlobalMetadataTemplates.
See the endpoint docs at API Reference.
await client.metadataTemplates.getGlobalMetadataTemplates();
GetGlobalMetadataTemplatesQueryParams
GetGlobalMetadataTemplatesHeadersInput
undefined | CancellationToken
This function returns a value of type MetadataTemplates.
Returns all of the metadata templates available to all enterprises and their corresponding schema.
Used to retrieve all metadata templates created to be used specifically within the user’s enterprise.
This operation is performed by calling function getEnterpriseMetadataTemplates.
See the endpoint docs at API Reference.
await client.metadataTemplates.getEnterpriseMetadataTemplates();
GetEnterpriseMetadataTemplatesQueryParams
GetEnterpriseMetadataTemplatesHeadersInput
undefined | CancellationToken
This function returns a value of type MetadataTemplates.
Returns all of the metadata templates within an enterprise and their corresponding schema.
Creates a new metadata template that can be applied to files and folders.
This operation is performed by calling function createMetadataTemplate.
See the endpoint docs at API Reference.
await client.metadataTemplates.createMetadataTemplate({
scope: 'enterprise',
displayName: templateKey,
templateKey: templateKey,
fields: [
{
type: 'string' as CreateMetadataTemplateRequestBodyFieldsTypeField,
key: 'testName',
displayName: 'testName',
} satisfies CreateMetadataTemplateRequestBodyFieldsField,
{
type: 'float' as CreateMetadataTemplateRequestBodyFieldsTypeField,
key: 'age',
displayName: 'age',
} satisfies CreateMetadataTemplateRequestBodyFieldsField,
{
type: 'date' as CreateMetadataTemplateRequestBodyFieldsTypeField,
key: 'birthDate',
displayName: 'birthDate',
} satisfies CreateMetadataTemplateRequestBodyFieldsField,
{
type: 'enum' as CreateMetadataTemplateRequestBodyFieldsTypeField,
key: 'countryCode',
displayName: 'countryCode',
options: [
{
key: 'US',
} satisfies CreateMetadataTemplateRequestBodyFieldsOptionsField,
{
key: 'CA',
} satisfies CreateMetadataTemplateRequestBodyFieldsOptionsField,
],
} satisfies CreateMetadataTemplateRequestBodyFieldsField,
{
type: 'multiSelect' as CreateMetadataTemplateRequestBodyFieldsTypeField,
key: 'sports',
displayName: 'sports',
options: [
{
key: 'basketball',
} satisfies CreateMetadataTemplateRequestBodyFieldsOptionsField,
{
key: 'football',
} satisfies CreateMetadataTemplateRequestBodyFieldsOptionsField,
{
key: 'tennis',
} satisfies CreateMetadataTemplateRequestBodyFieldsOptionsField,
],
} satisfies CreateMetadataTemplateRequestBodyFieldsField,
],
} satisfies CreateMetadataTemplateRequestBody);
CreateMetadataTemplateRequestBody
CreateMetadataTemplateOptionalsInputThis function returns a value of type MetadataTemplate.
The schema representing the metadata template created.