Box Developer Documentation

Update classification on folder

put
https://api.box.com/2.0
/folders/:folder_id/metadata/enterprise/securityClassification-6VMVochwUWo

Updates a classification on a folder.

The classification can only be updated if a classification has already been applied to the folder before. When editing classifications, only values are defined for the enterprise will be accepted.

Request

bearer [ACCESS_TOKEN]
application/json-patch+json

Path Parameters

stringin pathrequired
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.

Request Body

object arrayin bodyrequired

A list containing the one change to make, to update the classification label.

stringin bodyrequired
"replace"

replace

Value is always replace

stringin bodyrequired
"/Box__Security__Classification__Key"

Defines classifications available in the enterprise.

Value is always /Box__Security__Classification__Key

stringin bodyrequired
"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.

Response

application/jsonClassification

Returns the updated classification metadata template instance.

application/jsonClient error

Returns an error when the request body is not valid.

  • bad_request - The request body format is not an array of valid JSON Patch operations.
application/jsonClient error

Returns an error in some edge cases when the request body is not a valid array of JSON Patch items.

application/jsonClient error

An unexpected client error.

put
Update classification on folder
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X PUT "https://api.box.com/2.0/folders/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json-patch+json" \
     -d '[{
       "op": "replace",
       "path": "/Box__Security__Classification__Key",
       "value": "Internal"
     }]'
TypeScript Gen
await client.folderClassifications.updateClassificationOnFolder(folder.id, [
  new UpdateClassificationOnFolderRequestBody({
    value: secondClassification.key,
  }),
]);
Python Gen
client.folder_classifications.update_classification_on_folder(
    folder.id,
    [UpdateClassificationOnFolderRequestBody(value=second_classification.key)],
)
.NET Gen
await client.FolderClassifications.UpdateClassificationOnFolderAsync(folderId: folder.Id, requestBody: Array.AsReadOnly(new [] {new UpdateClassificationOnFolderRequestBody(value: secondClassification.Key)}));
Swift Gen (Beta)
try await client.folderClassifications.updateClassificationOnFolder(folderId: folder.id, requestBody: [UpdateClassificationOnFolderRequestBody(value: secondClassification.key)])
Java
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);
Python
classification = {
    'Box__Security__Classification__Key': 'Sensitive',
}
applied_metadata = client.folder(folder_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
.NET
var folderId = "0";
var update = new BoxMetadataUpdate
{
    Op = MetadataUpdateOp.replace,
    Path = "/Box_Security_Classification_Key",
    Value = "Very Sensitive"
};

var classificationData = await client.MetadataManager
    .UpdateFolderMetadataAsync(folderId, new List<BoxMetadataUpdate>(){ update }, "enterprise", "securityClassification-6VMVochwUWo");
Node
var classification = {
	Box__Security__Classification__Key: "Sensitive"
};
client.folders.addMetadata('11111', 'enterprise', 'securityClassification-6VMVochwUWo', classification)
	.then(metadata => {
		// the updated classification applied to the folder
	});

Response Example

{
  "$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"
}