# Start the upload
curl -u $ONE_CODEX_API_KEY: \
-X POST \
https://app.onecodex.com/api/v1/assets/init_multipart_upload
# This should return a response with the following JSON body:
#{
# "callback_url": "/api/v1/assets/confirm_multipart_upload",
# "file_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
# "s3_bucket": "onecodex-multipart-uploads-encrypted",
# "upload_aws_access_key_id": "XXXXXXXXXXXXXXXXXXXX",
# "upload_aws_secret_access_key": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
#}
# You can then upload your file to our AWS bucket
AWS_ACCESS_KEY_ID=$upload_aws_access_key_id \
AWS_SECRET_ACCESS_KEY=$upload_aws_secret_access_key \
aws s3 cp $filename \
"s3://onecodex-multipart-uploads-encrypted/$file_id" --sse
# Once the upload has completed, you will need to confirm it
curl -u $ONE_CODEX_API_KEY: \
-X POST -H "Content-Type: application/json" \
"https://app.onecodex.com/api/v1/assets/confirm_multipart_upload" \
-d @- << EOF
{
"s3_path": "s3://onecodex-multipart-uploads-encrypted/$file_id",
"filename": "$filename",
"name": "<an optional name for your asset>"
}
EOF