When an enterprise does not yet have any classifications, this API call initializes the classification template with an initial set of classifications.
If an enterprise already has a classification, the template will already exist and instead an API call should be made to add additional classifications.
false
Determines if classifications are copied along when the file or folder is copied.
"Classification"
The name of the template as shown in web and mobile interfaces.
Value is always Classification
The classification template requires exactly one field, which holds all the valid classification values.
"enum"
The type of the field that is always enum.
Value is always enum
"Classification"
A display name for the classification.
Value is always Classification
"Box__Security__Classification__Key"
Defines classifications available in the enterprise.
Value is always Box__Security__Classification__Key
The actual list of classifications that are present on this template.
"Sensitive"
The display name and key this classification. This will be show in the Box UI.
Additional information about the classification.
Additional information about the classification.
"enterprise"
The scope in which to create the classifications. This should
be enterprise
or enterprise_{id}
where id
is the unique
ID of the enterprise.
Value is always enterprise
"securityClassification-6VMVochwUWo"
Defines the list of metadata templates.
Value is always securityClassification-6VMVochwUWo
Returns a new securityClassification
metadata template, which
contains a Box__Security__Classification__Key
field that lists all
the classifications available to this enterprise.
Returned if any of the request parameters are not valid.
Returned when a template name is not correct. Please make sure the URL for the request is correct.
An unexpected client error.
curl -i -X POST "https://api.box.com/2.0/metadata_templates/schema" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"templateKey": "securityClassification-6VMVochwUWo",
"scope": "enterprise",
"displayName": "Classification",
"hidden": false,
"copyInstanceOnItemCopy": true,
"fields": [
{
"type": "enum",
"key": "Box__Security__Classification__Key",
"displayName": "Classification",
"hidden": false,
"options": [
{
"key": "Classified",
"staticConfig": {
"classification": {
"colorID": 7,
"classificationDefinition": "Top Seret"
}
}
}
]
}
]
}'
MetadataTemplate.Field classification = new MetadataTemplate.Field();
classification.setType("enum");
classification.setKey(Metadata.CLASSIFICATION_KEY);
classification.setDisplayName("Classification");
classification.setHidden("false");
List<String> options = new ArrayList<String>();
options.add("Top Secret");
classification.setOptions(topSecret)
List<MetadataTemplate.Field> fields = new ArrayList<MetadataTemplate.Field>();
fields.add(classification);
MetadataTemplate template = MetadataTemplate.createMetadataTemplate(api, Metadata.ENTERPRISE_METADATA_SCOPE, Metadata.CLASSIFICATION_TEMPLATE_KEY, "Classification", false, fields);
from boxsdk.object.metadata_template import MetadataField, MetadataFieldType
fields = [
MetadataField(MetadataFieldType.ENUM, 'Classification', key='Box__Security__Classification__Key', options=['Top Secret'])
]
template = client.create_metadata_template('Classification', fields, template_key='securityClassification-6VMVochwUWo')
var field = new BoxMetadataTemplateField
{
DisplayName = "Classification",
Type = "enum",
Key = "Box_Security_Classification_Key",
Options = new List<BoxMetadataTemplateFieldOption>()
{
new BoxMetadataTemplateFieldOption
{
Key = "Classified"
}
}
};
var metadataTemplate = new BoxMetadataTemplate
{
DisplayName = "Classification",
TemplateKey = "securityClassification-6VMVochwUWo",
Scope = "enterprise",
Fields = new List<BoxMetadataTemplateField>() { field },
};
var template = await client.MetadataManager.CreateMetadataTemplate(metadataTemplate);
client.metadata.createTemplate(
'Classification',
[
{
type: "enum",
key: "Box__Security__Classification__Key",
displayName: "Classification",
hidden: false,
options: [
{
key: "Classified",
staticConfig: {
classification: {
colorID: 7,
classificationDefinition: "Top Seret"
}
}
}
]
}
],
{
hidden: false,
templateKey: 'securityClassification-6VMVochwUWo'
}
)
.then(template => {
// the new classification template
});
{
"id": "58063d82-4128-7b43-bba9-92f706befcdf",
"type": "metadata_template",
"copyInstanceOnItemCopy": true,
"displayName": "Classification",
"fields": [
{
"id": "822227e0-47a5-921b-88a8-494760b2e6d2",
"type": "enum",
"key": "Box__Security__Classification__Key",
"displayName": "Classification",
"hidden": false,
"options": [
{
"id": "46aea176-3483-4431-856c-6b5b13d1cc50",
"key": "Sensitive",
"staticConfig": {
"classification": {
"classificationDefinition": "Sensitive information",
"colorID": 4
}
}
}
]
}
],
"hidden": false,
"scope": "enterprise_123456",
"templateKey": "securityClassification-6VMVochwUWo"
}