Manage Applications

    Create cascade policy

    post
    https://api.box.com/2.0
    /metadata_cascade_policies

    Creates a new metadata cascade policy that applies a given metadata template to a given folder and automatically cascades it down to its children.

    In order for the policy to work, a metadata instance must first be applied to the folder.

    Request

    application/json

    Request Body

    stringin bodyrequired
    12321

    The ID of the folder to assign the template to.

    stringin bodyrequired
    enterprise_27335

    The scope of the metadata template

    Value is one of "global", "enterprise_<id>"

    stringin bodyrequired
    productInfo

    The identifier of the metadata template.

    Response

    Returns a new of metadata cascade policy

    You can now try out some of our APIs live, right here in the documentation.
    Log In

    Request Example

    cURL
    curl -X POST https://api.box.com/2.0/metadata_cascade_policies \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d '{
           "folder_id": "12321",
           "scope": "enterprise_27335",
           "templateKey": "productInfo"
         }'
    .NET
    BoxMetadataCascadePolicy metadataCascadePolicy = await client.MetadataCascadePolicyManager
        .CreateCascadePolicyAsync("22222", "enterprise_11111", "templateKey");
    Python
    folder = client.folder(folder_id='22222')
    metadata_template = client.metadata_template('enterprise', 'securityClassiciation')
    
    cascade_policy = folder.cascade_metadata(metadata_template)
    print('Folder {0} has a metadata cascade policy for {1} template "{2}"'.format(
        cascade_policy.parent.id,
        cascade_policy.scope,
        cascade_policy.templateKey,
    ))
    Node
    var folderID = '22222';
    client.metadata.createCascadePolicy('enterprise', 'testTemplate', folderID)
    	.then(cascadePolicy => {
    		/* cascadePolicy -> {
    			id: '84113349-794d-445c-b93c-d8481b223434',
    			type: 'metadata_cascade_policy',
    			owner_enterprise: {
    				type: 'enterprise',
    				id: '11111'
    			},
    			parent: {
    				type: 'folder',
    				id: '22222'
    			},
    			scope: 'enterprise_11111',
    			templateKey: 'testTemplate'
    		}
    		*/
    	});

    Response Example

    {
      "id": "6fd4ff89-8fc1-42cf-8b29-1890dedd26d7",
      "owner_enterprise": {
        "type": "enterprise",
        "id": 690678
      },
      "parent": {
        "type": "folder",
        "id": 690678
      },
      "scope": "global",
      "templateKey": "demo"
    }