Update Folder
Update Folder
To update a folder in Box you will need to call the following API.
cURL
curl -X PUT https://api.box.com/2.0/folders/4353455 \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json" '
-d '{
"name": "New folder name"
}'
.NET
var requestParams = new BoxFolderRequest()
{
Id = "11111",
Name = "My Documents (2017)"
};
BoxFolder updatedFolder = await client.FoldersManager.UpdateInformationAsync(requestParams);
Java
BoxFolder folder = new BoxFolder(api, "id");
BoxFolder.Info info = folder.new Info();
info.setName("New Name");
folder.updateInfo(info);
Python
updated_folder = client.folder(folder_id='22222').update_info({
'name': '[ARCHIVED] Planning documents',
'description': 'Old planning documents',
})
print('Folder updated!')
Node
client.folders.update('11111', {name: 'Pictures from 2017'})
.then(updatedFolder => {
/* updatedFolder -> {
type: 'folder',
id: '11111',
sequence_id: '1',
etag: '1',
name: 'Pictures from 2017',
created_at: '2012-12-12T10:53:43-08:00',
modified_at: '2012-12-12T11:15:04-08:00',
description: 'Some pictures I took',
size: 629644,
path_collection:
{ total_count: 1,
entries:
[ { type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' } ] },
created_by:
{ type: 'user',
id: '22222',
name: 'Example User'
login: 'user@example.com' },
modified_by:
{ type: 'user',
id: '22222',
name: 'Example User',
login: 'user@example.com' },
owned_by:
{ type: 'user',
id: '22222',
name: 'Example User',
login: 'user@example.com' },
shared_link: null,
parent:
{ type: 'folder',
id: '0',
sequence_id: null,
etag: null,
name: 'All Files' },
item_status: 'active',
item_collection:
{ total_count: 1,
entries:
[ { type: 'file',
id: '33333',
sequence_id: '3',
etag: '3',
sha1: '134b65991ed521fcfe4724b7d814ab8ded5185dc',
name: 'tigers.jpeg' } ],
offset: 0,
limit: 100 } }
*/
});
Name restrictions
There are some restrictions to the file name. Names containing non-printable
ASCII characters, forward and backward slashes (/
, \
), as well as names
with trailing spaces are prohibited.
Additionally, the names .
and ..
are reserved names and therefore
also prohibited.
Timeout
Timeout for this operation is 60 seconds. The operation will complete
after a HTTP 503
has been returned.