Create a metadata cascade policy

Create a metadata cascade policy

When a metadata template has been applied to a folder, a metadata cascade policy can be created by calling the POST /metadata_cascade_policies API endpoint with the folder_id of the folder to apply the policy to, and the scope and templateKey of metadata template to.

cURL
curl -i -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'
		}
		*/
	});

To get the scope and templateKey for a template, either list all metadata templates, or list all instances on an file.

A cascade policy can only be created if a metadata instance has already been applied to the folder with the given scope and templateKey.