Box Developerドキュメント
最新バージョン

ストレージポリシー割り当てを更新

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

特定のストレージポリシー割り当てを更新します。

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
932483

ストレージポリシー割り当てのID。

リクエスト本文

object本文内

ユーザーまたは会社に割り当てるストレージポリシー

string本文内必須
"1434325"

割り当てるストレージポリシーのID。

string本文内必須
"storage_policy"

割り当てるタイプ。

次の値に固定: storage_policy

レスポンス

更新されたストレージポリシー割り当てオブジェクトを返します。

予期しないクライアントエラー。

put
ストレージポリシー割り当てを更新
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

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"
       }
     }'
TypeScript Gen
await client.storagePolicyAssignments.updateStoragePolicyAssignmentById(
  storagePolicyAssignment.id,
  {
    storagePolicy:
      new UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField({
        id: storagePolicy2.id,
      }),
  } satisfies UpdateStoragePolicyAssignmentByIdRequestBody,
);
Python Gen
client.storage_policy_assignments.update_storage_policy_assignment_by_id(
    storage_policy_assignment.id,
    UpdateStoragePolicyAssignmentByIdStoragePolicy(id=storage_policy_2.id),
)
.NET Gen
await client.StoragePolicyAssignments.UpdateStoragePolicyAssignmentByIdAsync(storagePolicyAssignmentId: storagePolicyAssignment.Id, requestBody: new UpdateStoragePolicyAssignmentByIdRequestBody(storagePolicy: new UpdateStoragePolicyAssignmentByIdRequestBodyStoragePolicyField(id: storagePolicy2.Id)));
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(data=updated_storage_policy)
print(f'Update storage policy ID is {updated_assignment.storage_policy.id}')
.NET
// Reassign user 1234 to storage policy 7
BoxStoragePolicyAssignment assignment = await client.StoragePoliciesManager
    .UpdateStoragePolicyAssignment(assignmentId: "dXNlcl8yMjIyMg==", policyId: "7");
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)")
}

レスポンスの例

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