Force-apply metadata to all items in a folder

Guides Metadata Metadata cascade policies Force-apply metadata to all items in a folder
Edit this page

Force-apply metadata to all items in a folder

When a metadata cascade policy already exists on a folder, the metadata instance can be force-applied to all items in a folder by calling the POST /metadata_cascade_policies/:id/apply API endpoint with the id of the metadata cascade policy.

curl -i -X POST "" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "conflict_resolution": "overwrite"
string policyId = "11111";
string conflictResolution = Constants.ConflictResolution.Overwrite
BoxMetadataCascadePolicy newCascadePolicy = client.MetadataCascadePolicyManager
    .ForceApplyCascadePolicyAsync(policyId, conflictResolution);
String cascadePolicyID = "e4392a41-7de5-4232-bdf7-15e0d6bba067";
BoxMetadataCascadePolicy policy = new BoxMetadataCascadePolicy(api, cascadePolicyID);
from boxsdk.object.metadata_cascade_policy import CascadePolicyConflictResolution

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

To get the id of the policy, list all policies for the folder.

The metadata cascade operation will be started off asynchronously. The API call will return directly with the 202 Accepted HTTP status code before the cascade operation is complete. There is currently no way to check for when this operation is finished.

Conflict resolution

An additional conflict_resolution parameter can be passed to this API to define how to deal with any existing instances of the template on any of the items in the folder.

By default, without setting any value for conflict_resolution this API will preserve the existing value on any items. When the value is set to overwrite, it will force-apply the value of the template attached to the cascade policy over any existing value.