Skip to content

CreateMultipartUploadPart endpoint

https://redmine.teklia.com/issues/9153

Requires #1926 (closed)

A new CreateMultipartUploadPart as a POST /api/v1/multipart/part/ allows to generate a presigned PUT URL to upload a single part inside of a multipart upload. It uses a MultipartUploadPartSerializer that inherits from MultipartUploadSerializer and adds:

  • part_number: required IntegerField, between 1 to 10000
  • checksum_algorithm: optional, nullable EnumField accepting the names of the multipart upload checksum algorithms
  • checksum: optional, nullable CharField
  • md5_hash: optional, nullable CharField
  • url: read-only URLField, for the return value

The serializer's validate() method must verify that either checksum and checksum_algorithm are null, or that both are set. If only one of the two fields are set, an HTTP 400 error occurs.

The serializer's create() method must return {"url": …} with a presigned URL for upload_part, generated like in this POC. ContentMD5 comes from the md5_hash, and one of the Checksum* parameters must be used depending on the algorithm. Both checksums must be base64-encoded.