フォルダのロックの作成
フォルダのロックの作成
Box内のフォルダにロックを作成するには、ロックを適用するフォルダのid
をBoxのAPIに指定します。必要に応じて、フォルダのロックとともに適用する特定のlocked_operations
を指定できます。
cURL
curl -i -X POST "https://api.box.com/2.0/folder_locks" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"folder": {
"type": "folder",
"id": "33552487093"
},
"locked_operations": {
"move": true,
"delete": true
}
}'
TypeScript Gen
await client.folderLocks.createFolderLock({
folder: {
id: folder.id,
type: 'folder',
} satisfies CreateFolderLockRequestBodyFolderField,
lockedOperations: {
move: true,
delete: true,
} satisfies CreateFolderLockRequestBodyLockedOperationsField,
} satisfies CreateFolderLockRequestBody);
Python Gen
client.folder_locks.create_folder_lock(
CreateFolderLockFolder(id=folder.id, type="folder"),
locked_operations=CreateFolderLockLockedOperations(move=True, delete=True),
)
.NET Gen
await client.FolderLocks.CreateFolderLockAsync(requestBody: new CreateFolderLockRequestBody(folder: new CreateFolderLockRequestBodyFolderField(id: folder.Id, type: "folder")) { LockedOperations = new CreateFolderLockRequestBodyLockedOperationsField(move: true, delete: true) });
iOS
client.folders.createLock(folderId: "22222") { (result: Result<FolderLock, BoxSDKError>) in
guard case let .success(folderLock) = result else {
print("Error creating folder lock")
return
}
print("Created folder lock with id \"\(folderLock.id)\" inside of folder with id \"\(folderLock.folder?.id)\"")
}
ロック操作
フォルダに適用できるロック操作には、move
とdelete
の2つがあります。
move