Creates an upload session for an existing file.
12345
The unique identifier that represents a file.
The ID for any file can be determined
by visiting a file in the web application
and copying the ID from the URL. For example,
for the URL https://*.app.box.com/files/123
the file_id
is 123
.
"Project.mov"
The optional new name of new file
104857600
The total number of bytes of the file to be uploaded
Returns a new upload session.
Returns an error if the file already exists, or if the account has run out of disk space.
An unexpected client error.
curl -i -X POST "https://upload.box.com/api/2.0/files/12345/upload_sessions" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-H "content-type: application/json" \
-d '{
"file_size": 104857600
}'
file_size = 26000000
upload_session = client.file('11111').create_upload_session(file_size)
print(f'Created upload session {upload_session.id} with chunk size of {upload_session.part_size} bytes')
{
"id": "F971964745A5CD0C001BBE4E58196BFD",
"type": "upload_session",
"num_parts_processed": 455,
"part_size": 1024,
"session_endpoints": {
"abort": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
"commit": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit",
"list_parts": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts",
"log_event": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/log",
"status": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
"upload_part": "https://{box-upload-server}/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD"
},
"session_expires_at": "2012-12-12T10:53:43-08:00",
"total_parts": 1000
}