Force-apply metadata cascade policy to folder

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

Force the metadata on a folder with a metadata cascade policy to be applied to all of its children. This can be used after creating a new cascade policy to enforce the metadata to be cascaded down to all existing files within that folder.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
6fd4ff89-8fc1-42cf-8b29-1890dedd26d7

The ID of the cascade policy to force-apply.

Request Body

stringin bodyrequired
"none"

Describes the desired behavior when dealing with the conflict where a metadata template already has an instance applied to a child.

  • none will preserve the existing value on the file
  • overwrite will force-apply the templates values over any existing values.

Value is one of none,overwrite

Response

none

Returns an empty response when the API call was successful. The metadata cascade operation will be performed asynchronously.

The API call will return directly, before the cascade operation is complete. There is currently no API to check for the status of this operation.

application/jsonClient error

Returns an error when the policy can not be found or the user does not have access to the folder.

  • instance_not_found - The policy could not be found
  • not_found - The folder could not be found or the user does not have access to the folder.
application/jsonClient error

An unexpected client error.

post
Force-apply metadata cascade policy to folder
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_cascade_policies/21312/apply" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "conflict_resolution": "overwrite"
     }'
.NET
string policyId = "11111";
string conflictResolution = Constants.ConflictResolution.Overwrite
BoxMetadataCascadePolicy newCascadePolicy = client.MetadataCascadePolicyManager
    .ForceApplyCascadePolicyAsync(policyId, conflictResolution);
Java
String cascadePolicyID = "e4392a41-7de5-4232-bdf7-15e0d6bba067";
BoxMetadataCascadePolicy policy = new BoxMetadataCascadePolicy(api, cascadePolicyID);
policy.forceApply("none");
Python
from boxsdk.object.metadata_cascade_policy import CascadePolicyConflictResolution

cascade_policy = client.metadata_cascade_policy(policy_id='84113349-794d-445c-b93c-d8481b223434')
cascade_policy.force_apply(CascadePolicyConflictResolution.PRESERVE_EXISTING)
print('Cascade policy was force applied!')
Node
var policyID = '84113349-794d-445c-b93c-d8481b223434';
client.metadata.forceApplyCascadePolicy(policyID, client.metadata.cascadeResolution.PRESERVE_EXISTING)
	.then(() => {
		// application started — no value returned
	});
TypeScript (Beta)
await client.metadataCascadePolicies.applyMetadataCascadePolicy(
  cascadePolicyId,
  {
    conflictResolution:
      'overwrite' as ApplyMetadataCascadePolicyRequestBodyConflictResolutionField,
  } satisfies ApplyMetadataCascadePolicyRequestBody
);
Python (Beta)
client.metadata_cascade_policies.apply_metadata_cascade_policy(cascade_policy_id, ApplyMetadataCascadePolicyConflictResolution.OVERWRITE.value)
.NET (Beta)
await client.MetadataCascadePolicies.ApplyMetadataCascadePolicyAsync(metadataCascadePolicyId: cascadePolicyId, requestBody: new ApplyMetadataCascadePolicyRequestBody(conflictResolution: ApplyMetadataCascadePolicyRequestBodyConflictResolutionField.Overwrite)).ConfigureAwait(false)