Update storage policy assignment

put
https://api.box.com/2.0
/storage_policy_assignments/:storage_policy_assignment_id/

Updates a specific storage policy assignment.

Request

Bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
932483

The ID of the storage policy assignment.

Request Body

objectin body

The storage policy to assign to the user or enterprise

stringin bodyrequired
1434325

The ID of the storage policy to assign.

stringin bodyrequired
storage_policy

Value is always storage_policy

Response

Returns an updated storage policy assignment object.

application/jsonClient error

An unexpected client error.

put
Update storage policy assignment
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X PUT "https://api.box.com/2.0/storage_policy_assignments/932483" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "storage_policy": {
         "type": "storage_policy",
         "id": "1434325"
       }
     }'
.NET
// Reassign user 1234 to storage policy 7
BoxStoragePolicyAssignment assignment = await client.StoragePoliciesManager
    .UpdateStoragePolicyAssignment(assignmentId: "dXNlcl8yMjIyMg==", policyId: "7");
Java
BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api, "ASSIGNMENT_ID");
BoxStoragePolicyAssignment.Info assignmentInfo = storagePolicyAssignment.new Info();
assignmentInfo.setStoragePolicyID("NEW_STORAGE_POLICY_ID");
storagePolicyAssignment.updateInfo(assignmentInfo);
Python
updated_storage_policy = {'storage_policy': {'type': 'storage_policy', 'id': '12345'}}
updated_assignment = client.storage_policy_assignment(assignment_id='ZW50ZXJwcmldfgeV82MDMwMDQ=').update_info(updated_storage_policy)
print('Update storage policy ID is {0}'.format(updated_assignment.storage_policy.id))
Node
// Reassign user 22222 to storage policy 10
var assignmentID = 'dXNlcl8yMjIyMg==';
var updates = {
    storage_policy: {
        type: 'storage_policy',
        id: '10'
    }
};

client.storagePolicies.updateAssignment(assignmentID, updates)
    .then(updatedAssignment => {
        /* updatedAssignment -> {
            type: 'storage_policy_assignment',
            id: 'dXNlcl8yMjIyMg==',
            storage_policy: 'storage_policy', id: '10' },
            assigned_to: { type: 'user', id: '22222' } }
        */
    });
iOS
client.storagePolicy.updateAssignment(storagePolicyAssignmentId: "1234", storagePolicyId: "123") { (result: Result<StoragePolicyAssignment, BoxSDKError>) in
    guard case let .success(assignment) = result else {
        print("Error updating a storage policy assignment")
        return
    }
    print("Updated storage policy assignment \(assignment.id)")
}

Response Example

{
  "assigned_to": {
    "id": 11446498,
    "type": "file"
  },
  "storage_policy": {
    "id": 11446498,
    "type": "storage_policy"
  }
}