Manage Applications

    Force apply cascade policy

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

    If a policy already exists on a folder, this will apply that policy to all existing files and sub-folders within the target folder.

    Request

    application/json

    Path Parameters

    stringin pathrequired
    21312

    The ID of the cascade policy.

    Request Body

    stringin bodyrequired
    overwrite

    The desired behavior for conflict-resolution if a template already exists on a given file or folder.

    • 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

    Returns the metadata cascade policy when the policy has been applied.

    The metadata cascade operation will be kicked off asynchronously. The API call will return right away but before the cascade operation is complete. There is currently no way to check for when this operation has finished.

    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/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
    	});

    Response Example

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