Multiparts file upload
Like single file upload, multiparts file upload is a 3 steps process:
1 - Initialize
Uploading large files requires splitting them to facilitate and speed up the upload process.
The upload needs to be initialized in multiple parts. The upload is done to a temporary secure repository.
You need to provide 2 informations for this upload initialization: the file name and its size (in bytes).
Example of POST content:
{
"name": "filename.mp4",
"size": "5500000"
}
You need to make a POST request with this information to the Multipart upload initialization endpoint.
Example of response:
{
"parts":[
{"signedUrl":"...","PartNumber":1},
{"signedUrl":"...","PartNumber":2}
],
"chunkSize":8000000,
"fileId":"....",
"fileKey":"pathid\/filename.mp4"
}
- The API provides the following identifiers for the upload:
- fileId: Upload identifier
- fileKey: File identifier
- The chunkSize, which is the size of the parts to upload.
- The list of locations where the parts should be deposited, parts.
2 - Upload your file
The file parts need to be sent to the different signed URLs. The POST request for each part will return an Etag in the headers, which needs to be saved and associated with the partNumber.
Example of response headers:
HTTP/1.1 200 OK
x-amz-id-2: G7Pb1v1+QNQOmSvObizDgK95sRgXUkV3n1D8NG//DS7nDv389LFOLZMqqENJ3TVPRIpRHufXFuY=
x-amz-request-id: EZVXM83AQ3YBT6JN
Date: Mon, 12 Jun 2023 14:00:21 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, PUT, POST
Access-Control-Expose-Headers: ETag
Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
ETag: "e7c9741c3239200fd06d7bc0f8bc08a8"
x-amz-server-side-encryption: AES256
Server: AmazonS3
Content-Length: 0
3 - Finalize
Once all the parts are sent, you need to notify 42videobricks (Multipart upload finalization) to reconstruct the file and trigger the video ingestion (transcoding) flow.
Example of POST content:
{
"fileKey": "...",
"fileId": "pathid\/filename.mp4",
"parts":[
{"PartNumber":1,"Etag":"e7c9741c3239200fd06d7bc0f8bc08a8"},
{"PartNumber":2,"Etag":"b2ee8d5fc90ebd71523f320fd0b8e859"}
]
}
The API will return true if everything goes well or false in case of an error.
Updated over 1 year ago