Add initial classifications

post
https://api.box.com/2.0
/metadata_templates/schema

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.

Request

Bearer [ACCESS_TOKEN]
application/json

Request Body

booleanin bodyoptional
false

false

stringin bodyrequired
"Classification"

Classification

Value is always Classification

object arrayin bodyoptional

The classification template holds one field, which holds all the valid classification values.

stringin bodyoptional
"enum"

enum

Value is always enum

stringin bodyoptional
"Classification"

Classification

Value is always Classification

booleanin bodyoptional
false

false

stringin bodyoptional
"Box__Security__Classification__Key"

Box__Security__Classification__Key

Value is always Box__Security__Classification__Key

object arrayin bodyoptional

The actual list of classifications that are present on this template.

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

booleanin bodyoptional
false

false

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

stringin bodyoptional
"securityClassification-6VMVochwUWo"

securityClassification-6VMVochwUWo

Value is always securityClassification-6VMVochwUWo

Response

Returns a new securityClassification metadata template, which contains a Box__Security__Classification__Key field that lists all the classifications available to this enterprise.

application/jsonClient error

Returned if any of the request parameters are not valid.

application/jsonClient error

Returned when a template name is not correct. Please make sure the URL for the request is correct.

application/jsonClient error

An unexpected client error.

post
Add initial classifications
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
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"
                 }
               }
             }
           ]
         }
       ]
     }'
.NET
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);
Java
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);
Python
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')
Node
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
	});

Response Example

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