File upload¶
Single part (files <8mb)¶
POST /v1/files/singlepart/init
Response will have id
, presigned_s3_data.url
and presigned_s3_data.fields
.
The id
will be used when submitting an analysis - it will reference the file IDs to analyze.
Assemble formdata, appending each key/value from fields
. Append the file as well to the formdata.
Finally, POST
the formdata to the url.
Multi part¶
-
Initialize the multi-part upload
POST /v1/files/multipart/init
Response will have
id
(the BugSeq file ID) andpresigned_s3_data.UploadId
. TheUploadId
will be used to upload each chunk. -
Upload Each Chunk
BugSeq recommends a 8mb chunk size.
For each chunk:
-
Initialize the chunk upload
POST /v1/files/multipart/chunk
. Don’t include the raw file data. The body should be JSON and contain:{ "file_id": fileId, "upload_id": uploadId, "part_number": partNumber // partNumber should start at 1, not 0! }
The response will contain a presigned address in the
presigned_s3_data
field. -
Upload the chunk data
PUT resp.presigned_s3_data
with the raw data in the body.Note you will need to retrieve the
ETag
header from the response. You should keep track ofETag
andPartNumber
tuples.
-
-
Finally, complete the upload:
POST /v1/files/multipart/complete
The body should contain:
{ "file_id": fileId, "upload_id": presigned_s3_data.UploadId, parts: [{ "ETag": "etag1", "PartNumber": "partnumber1" }, ...] }