Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

List retention policy assignments

get
https://api.box.com/2.0
/retention_policies/:retention_policy_id/assignments

Returns a list of all retention policy assignments associated with a specified retention policy.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
982312

The ID of the retention policy.

Query Parameters

stringin queryoptional
metadata_template

The type of the retention policy assignment to retrieve.

Value is one of folder,enterprise,metadata_template

string arrayin queryoptional
id,type,name

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

integer (int64)in queryoptional
10001000

The maximum number of items to return per page.

stringin queryoptional
JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii

Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination.

Response

Returns a list of the retention policy assignments associated with the specified retention policy.

application/jsonClient error

Returns an error if an unknown type is specified.

application/jsonClient error

An unexpected client error.

get
List retention policy assignments
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X GET "https://api.box.com/2.0/retention_policies/982312/assignments" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.retentionPolicyAssignments.getRetentionPolicyAssignments(
  retentionPolicy.id
);
Python Gen
client.retention_policy_assignments.get_retention_policy_assignments(
    retention_policy.id
)
.NET Gen
await client.RetentionPolicyAssignments.GetRetentionPolicyAssignmentsAsync(retentionPolicyId: retentionPolicy.Id);
Java
BoxRetentionPolicy policy = new BoxRetentionPolicy(api, id);
Iterable<BoxRetentionPolicyAssignment.Info> allAssignments = policy.getAllAssignments("assigned_by");
Iterable<BoxRetentionPolicyAssignment.Info> folderAssignments = policy.getFolderAssignments(50, "assigned_by");
Iterable<BoxRetentionPolicyAssignment.Info> enterpriseAssignments = policy.getEnterpriseAssignments();
for (BoxRetentionPolicyAssignments.Info assignmentInfo : allAssignments) {
	// Do something with the assignment.
}
for (BoxRetentionPolicyAssignments.Info assignmentInfo : folderAssignments) {
	// Do something with the assignment.
}
for (BoxRetentionPolicyAssignments.Info assignmentInfo : enterpriseAssignments) {
	// Do something with the assignment.
}
.NET
BoxCollectionMarkerBased<BoxRetentionPolicyAssignment> assignments = await client.RetentionPoliciesManager
    .GetRetentionPolicyAssignmentsAsync(retentionPolicyId: "11111");
Node
client.retentionPolicies
	.getAssignments('123456789', { type: 'folder' })
	.then((assignments) => {
		/* assignments -> {
			entries: [ { type: 'retention_policy_assignment', id: '12345678' } ],
			limit: 100,
			next_marker: 'someMarkerString' }
		*/
	});
iOS
let iterator = client.retentionPolicy.listAssignments(policyId:"12345")
iterator.next { results in
    switch results {
    case let .success(page):
        for assignment in page.entries {
            print("Retention policy assignment\(assignment.id)")
        }
        
    case let .failure(error):
        print(error)
    }
}

Response Example

{
  "entries": [
    {
      "id": "11446498",
      "type": "retention_policy_assignment",
      "retention_policy": {
        "id": "12345",
        "type": "retention_policy",
        "policy_name": "Some Policy Name",
        "retention_length": "365",
        "disposition_action": "permanently_delete"
      },
      "assigned_to": {
        "id": "a983f69f-e85f-4ph4-9f46-4afdf9c1af65",
        "type": "metadata_template"
      },
      "filter_fields": [
        {
          "field": "a0f4ee4e-1dc1-4h90-a8a9-aef55fc681d4",
          "value": "0c27b756-0p87-4fe0-a43a-59fb661ccc4e"
        }
      ],
      "assigned_by": {
        "id": "11446498",
        "type": "user",
        "name": "Aaron Levie",
        "login": "ceo@example.com"
      },
      "assigned_at": "2012-12-12T10:53:43-08:00",
      "start_date_field": "upload_date"
    }
  ],
  "limit": 1000,
  "next_marker": "JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii"
}