Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Creates a folder lock on a folder, preventing it from being moved and/or deleted.
You must be authenticated as the owner or co-owner of the folder to use this endpoint.
The folder to apply the lock to.
"1234567890"
The ID of the folder.
"folder"
The content type the lock is being applied to. Only folder
is supported.
The operations to lock for the folder. If locked_operations
is
included in the request, both move
and delete
must also be
included and both set to true
.
true
Whether deleting the folder should be locked.
true
Whether moving the folder should be locked.
Returns the instance of the folder lock that was applied to the folder, including the user that applied the lock and the operations set.
Returns an error when the request body is not valid.
schema_validation_failed
- The request body contains a value for
a field that either does not exist, or for which the value or type does
not match the expected field type. An example might be an unknown option
for an enum
or multiSelect
field.Returns an error when the folder was not found.
not_found
- The folder could not be found, the user does not have
access to the folder, or the user making call is not an owner or co-owner
of folder.An unexpected client error.
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
}
}'
await client.folderLocks.createFolderLock({
folder: {
id: folder.id,
type: 'folder',
} satisfies CreateFolderLockRequestBodyFolderField,
lockedOperations: {
move: true,
delete: true,
} satisfies CreateFolderLockRequestBodyLockedOperationsField,
} satisfies CreateFolderLockRequestBody);
client.folder_locks.create_folder_lock(
CreateFolderLockFolder(id=folder.id, type="folder"),
locked_operations=CreateFolderLockLockedOperations(move=True, delete=True),
)
await client.FolderLocks.CreateFolderLockAsync(requestBody: new CreateFolderLockRequestBody(folder: new CreateFolderLockRequestBodyFolderField(id: folder.Id, type: "folder")) { LockedOperations = new CreateFolderLockRequestBodyLockedOperationsField(move: true, delete: true) });
try await client.folderLocks.createFolderLock(requestBody: CreateFolderLockRequestBody(folder: CreateFolderLockRequestBodyFolderField(id: folder.id, type: "folder"), lockedOperations: CreateFolderLockRequestBodyLockedOperationsField(move: true, delete: true)))
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)\"")
}
{
"id": "12345678",
"type": "folder_lock",
"created_at": "2020-09-14T23:12:53Z",
"created_by": {
"id": "11446498",
"type": "user"
},
"folder": {
"id": "12345",
"type": "folder",
"etag": "1",
"name": "Contracts",
"sequence_id": "3"
},
"lock_type": "freeze",
"locked_operations": {
"delete": true,
"move": true
}
}