Retrieves all metadata for a given file.
This operation is performed by calling function getFileMetadata.
See the endpoint docs at API Reference.
await client.fileMetadata.getFileMetadata(file.id);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”GetFileMetadataOptionalsInputThis function returns a value of type Metadatas.
Returns all the metadata associated with a file.
This API does not support pagination and will therefore always return all of the metadata associated to the file.
Retrieves the instance of a metadata template that has been applied to a file.
This operation is performed by calling function getFileMetadataById.
See the endpoint docs at API Reference.
await client.fileMetadata.getFileMetadataById(
file.id,
'global' as GetFileMetadataByIdScope,
'properties',
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”GetFileMetadataByIdScope
string
GetFileMetadataByIdOptionalsInputThis function returns a value of type MetadataFull.
An instance of the metadata template that includes additional “key:value” pairs defined by the user or an application.
Applies an instance of a metadata template to a file.
In most cases only values that are present in the metadata template
will be accepted, except for the global.properties template which accepts
any key-value pair.
This operation is performed by calling function createFileMetadataById.
See the endpoint docs at API Reference.
await client.fileMetadata.createFileMetadataById(
file.id,
'enterprise' as CreateFileMetadataByIdScope,
templateKey,
{
['name']: 'John',
['age']: 23,
['birthDate']: '2001-01-03T02:20:50.520Z',
['countryCode']: 'US',
['sports']: ['basketball', 'tennis'],
},
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”CreateFileMetadataByIdScope
string
CreateFileMetadataByIdRequestBody
CreateFileMetadataByIdOptionalsInputThis function returns a value of type MetadataFull.
Returns the instance of the template that was applied to the file, including the data that was applied to the template.
Updates a piece of metadata on a file.
The metadata instance can only be updated if the template has already been applied to the file before. When editing metadata, only values that match the metadata template schema will be accepted.
The update is applied atomically. If any errors occur during the application of the operations, the metadata instance will not be changed.
This operation is performed by calling function updateFileMetadataById.
See the endpoint docs at API Reference.
await client.fileMetadata.updateFileMetadataById(
file.id,
'enterprise' as UpdateFileMetadataByIdScope,
templateKey,
[
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyOpField,
path: '/name',
value: 'Jack',
} satisfies UpdateFileMetadataByIdRequestBody,
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyOpField,
path: '/age',
value: 24,
} satisfies UpdateFileMetadataByIdRequestBody,
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyOpField,
path: '/birthDate',
value: '2000-01-03T02:20:50.520Z',
} satisfies UpdateFileMetadataByIdRequestBody,
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyOpField,
path: '/countryCode',
value: 'CA',
} satisfies UpdateFileMetadataByIdRequestBody,
{
op: 'replace' as UpdateFileMetadataByIdRequestBodyOpField,
path: '/sports',
value: ['football'],
} satisfies UpdateFileMetadataByIdRequestBody,
],
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”UpdateFileMetadataByIdScope
string
readonly UpdateFileMetadataByIdRequestBody[]
UpdateFileMetadataByIdOptionalsInputThis function returns a value of type MetadataFull.
Returns the updated metadata template instance, with the custom template data included.
Deletes a piece of file metadata.
This operation is performed by calling function deleteFileMetadataById.
See the endpoint docs at API Reference.
await client.fileMetadata.deleteFileMetadataById(
file.id,
'enterprise' as DeleteFileMetadataByIdScope,
templateKey,
);
string
https://*.app.box.com/files/123 the file_id is 123. Example: “12345”DeleteFileMetadataByIdScope
string
DeleteFileMetadataByIdOptionalsInputThis function returns a value of type undefined.
Returns an empty response when the metadata is successfully deleted.