Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Adds a classification to a folder by specifying the label of the classification to add.
This API can also be called by including the enterprise ID in the
URL explicitly, for example
/folders/:id/enterprise_12345/securityClassification-6VMVochwUWo
.
12345
The unique identifier that represent a folder.
The ID for any folder can be determined
by visiting this folder in the web application
and copying the ID from the URL. For example,
for the URL https://*.app.box.com/folder/123
the folder_id
is 123
.
The root folder of a Box account is
always represented by the ID 0
.
"Sensitive"
The name of the classification to apply to this folder.
To list the available classifications in an enterprise, use the classification API to retrieve the classification template which lists all available classification keys.
Returns the classification template instance that was applied to the folder.
Returns an error when the request body is not valid.
schema_validation_failed
- The request body contains a value for
a field that either does not exist, or for which the value or type does
not match the expected field type. An example might be an unknown option
for an enum
or multiSelect
field.Returns an error when the folder or metadata template was not found.
not_found
- The folder could not be found, or the user does not have
access to the folder.instance_tuple_not_found
- The metadata template was not found.Returns an error when an instance of this metadata template is already present on the folder.
tuple_already_exists
- An instance of them metadata template already
exists on the folder.An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/folders/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"Box__Security__Classification__Key": "Sensitive"
}'
await client.folderClassifications.addClassificationToFolder(folder.id, {
requestBody: {
boxSecurityClassificationKey: classification.key,
} satisfies AddClassificationToFolderRequestBody,
} satisfies AddClassificationToFolderOptionalsInput);
client.folder_classifications.add_classification_to_folder(
folder.id, box_security_classification_key=classification.key
)
await client.FolderClassifications.AddClassificationToFolderAsync(folderId: folder.Id, requestBody: new AddClassificationToFolderRequestBody() { BoxSecurityClassificationKey = classification.Key });
try await client.folderClassifications.addClassificationToFolder(folderId: folder.id, requestBody: AddClassificationToFolderRequestBody(boxSecurityClassificationKey: classification.key))
BoxFolder folder = new BoxFolder(api, "id");
Metadata metadata = new Metadata()
metadata.add(Metadata.CLASSIFICATION_KEY, "Sensitive")
folder.setMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY, Metadata.ENTERPRISE_METADATA_SCOPE, metadata);
classification = {
'Box__Security__Classification__Key': 'Sensitive',
}
applied_metadata = client.folder(folder_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
var folderId = "0";
var classification = new Dictionary<string, object>
{
{ "Box_Security_Classification_Key", "Sensitive" }
};
var classificationData = await client.MetadataManager.SetFolderMetadataAsync(folderId, classification, "enterprise", "securityClassification-6VMVochwUWo");
var classification = {
Box__Security__Classification__Key: "Sensitive"
};
client.folders.addMetadata('11111', 'enterprise', 'securityClassification-6VMVochwUWo', classification)
.then(metadata => {
// the classification applied to the folder
});
{
"$canEdit": true,
"$parent": "folder_59449484661,",
"$scope": "enterprise_27335",
"$template": "securityClassification-6VMVochwUWo",
"$type": "securityClassification-6VMVochwUWo-fd31537a-0f95-4d86-9f2b-5974a29978f8",
"$typeVersion": 5,
"$version": 1,
"Box__Security__Classification__Key": "Sensitive"
}