Updates a classification on a file.
The classification can only be updated if a classification has already been applied to the file before. When editing classifications, only values are defined for the enterprise will be accepted.
12345
The unique identifier that represents a file.
The ID for any file can be determined
by visiting a file in the web application
and copying the ID from the URL. For example,
for the URL https://*.app.box.com/files/123
the file_id
is 123
.
A list containing the one change to make, to update the classification label.
"replace"
replace
Value is always replace
"/Box__Security__Classification__Key"
Defines classifications available in the enterprise.
Value is always /Box__Security__Classification__Key
"Sensitive"
The name of the classification to apply to this file.
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 updated classification metadata template instance.
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.Returns an error in some edge cases when the request body is not a valid array of JSON Patch items.
An unexpected client error.
curl -i -X PUT "https://api.box.com/2.0/files/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"
}]'
await client.fileClassifications.updateClassificationOnFile(file.id, [
new UpdateClassificationOnFileRequestBody({
value: secondClassification.key,
}),
]);
client.file_classifications.update_classification_on_file(
file.id, [UpdateClassificationOnFileRequestBody(value=second_classification.key)]
)
await client.FileClassifications.UpdateClassificationOnFileAsync(fileId: file.Id, requestBody: Array.AsReadOnly(new [] {new UpdateClassificationOnFileRequestBody(value: secondClassification.Key)}));
BoxFile file = new BoxFile(api, "id");
Metadata metadata = new Metadata()
metadata.add(Metadata.CLASSIFICATION_KEY, "Sensitive")
file.setMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY, Metadata.ENTERPRISE_METADATA_SCOPE, metadata);
classification = {
'Box__Security__Classification__Key': 'Sensitive',
}
applied_metadata = client.file(file_id='11111').metadata(scope='enterprise', template='securityClassification-6VMVochwUWo').set(classification)
var fileId = "0";
var update = new BoxMetadataUpdate
{
Op = MetadataUpdateOp.replace,
Path = "/Box_Security_Classification_Key",
Value = "Very Sensitive"
};
var classificationData = await client.MetadataManager
.UpdateFileMetadataAsync(fileId, new List<BoxMetadataUpdate>() { update }, "enterprise", "securityClassification-6VMVochwUWo");
var classification = {
Box__Security__Classification__Key: "Sensitive"
};
client.files.addMetadata('11111', 'enterprise', 'securityClassification-6VMVochwUWo', classification)
.then(metadata => {
// the updated classification applied to the file
});
{
"$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"
}