Creates a new metadata cascade policy that applies a given metadata template to a given folder and automatically cascades it down to any files within that folder.
In order for the policy to be applied a metadata instance must first be applied to the folder the policy is to be applied to.
1234567
The ID of the folder to apply the policy to. This folder will need to already have an instance of the targeted metadata template applied to it.
enterprise
The scope of the targeted metadata template. This template will need to already have an instance applied to the targeted folder.
Value is one of global
,enterprise
productInfo
The key of the targeted metadata template. This template will need to already have an instance applied to the targeted folder.
Returns a new of metadata cascade policy
Returns an error when any of the parameters are not in a valid format.
bad_request
- Either the scope
, templateKey
, or folder_id
are
not in a valid format.Returns an error when trying to apply a policy to a restricted folder, for
example the root folder with ID 0
.
forbidden
- Although the folder ID was valid and the user has access
to the folder, the policy could not be applied to this folder.Returns an error when the template or folder can not be found, or when the user does not have access to the folder or template.
instance_tuple_not_found
- The template could not be found or the user
does not have access to the template.not_found
- The folder could not be found or the user
does not have access to the folder.Returns an error when a policy for this folder and template is already in place.
tuple_already_exists
- A cascade policy for this combination of
folder_id
, scope
and templateKey
already exists.An unexpected client error.
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"
}'
BoxMetadataCascadePolicy metadataCascadePolicy = await client.MetadataCascadePolicyManager
.CreateCascadePolicyAsync("22222", "enterprise_11111", "templateKey");
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,
))
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'
}
*/
});