Skip to content

Instantly share code, notes, and snippets.

@drexler
Last active May 3, 2018 20:11
Show Gist options
  • Save drexler/e020355d5799afb3ec8d4f5dcf51825a to your computer and use it in GitHub Desktop.
Save drexler/e020355d5799afb3ec8d4f5dcf51825a to your computer and use it in GitHub Desktop.
uploading strategies
// Option one: directly upload base64 encoded files
// Pros: one network trip
// Cons: large attachments might cause processing delays and eventual lambda timeout
POST /tenants/{tenantId}/uploads
{
"items": [
{
"filename": "someLogo",
"filenameWithExtension": "someLogo.ext",
"payload": "base64encodedString"
},
{
"filename": "toysRus",
"filenameWithExtension": "toysRus.ru",
"payload": "base64encodedString"
}
]
}
// Option two: request a presigned url for uploads
// Pros: one url to use to upload to S3 directly, no timeouts involved
// Cons: requires 3 network trips for uploads to be done
POST /tenants/{tenantId}/presignedUrl
{
"use": ["download"|"delete"|"upload"],
"item": {
"filename": "toysRus",
"filenameWithExtension": "toysRus.ru",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment