Can anybody help on the HTTP put request to upload an attachment to the AWS S3?
I managed to successfully make a request to attachments/s3_form for a pre-authorized upload form.
A working example on POSTMAN or similar would be highly appreciated
Hi Dario.
You can find a Postman example at the end of my message (unfortunately I can't attach it as attachment since only images are allowed). Save it as S3.postman_collection.json
and import into Postman.
Basically you have to put data.fields
into your POST request to s3 along with file itself. Please notice that key
field has to be filled according to x-ignore-pattern
.
Postman example:
{
"variables": [],
"info": {
"name": "S3",
"_postman_id": "b736d22a-64d1-d91d-ab9d-89317174fafc",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Upload File To S3 Storage",
"request": {
"url": "https://s3-us-west-1.amazonaws.com/onepagecrm-ud2-us-west-1/",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data",
"description": "",
"disabled": true
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "key",
"value": "5c8681c6007d496a1d8942a9/1562933300863/blah.png",
"description": ""
},
{
"key": "x-ignore-pattern",
"value": "5c8681c6007d496a1d8942a9/__timestamp__/${filename}",
"description": ""
},
{
"key": "acl",
"value": "private",
"description": ""
},
{
"key": "success_action_status",
"value": "201",
"description": ""
},
{
"key": "policy",
"value": "eyJleHBpcmF0aW9uIjoiMjAxOS0wNy0xMlQxNDoyNDo0My4wMDBaIiwiY29uZGl0aW9ucyI6W3siYnVja2V0Ijoib25lcGFnZWNybS11ZDItdXMtd2VzdC0xIn0seyJhY2wiOiJwcml2YXRlIn0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSx7IngtYW16LWFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IngtYW16LWNyZWRlbnRpYWwiOiJBS0lBVFhMUzdPRVVUWDJTTDRZSi8yMDE5MDcxMi91cy13ZXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJ4LWFtei1kYXRlIjoiMjAxOTA3MTJUMTIyNDQzWiJ9LFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjBdLFsic3RhcnRzLXdpdGgiLCIka2V5IiwiNWM4NjgxYzYwMDdkNDk2YTFkODk0MmE5Il0sWyJzdGFydHMtd2l0aCIsIiRmaWxlbmFtZSIsIiJdXX0=",
"description": ""
},
{
"key": "x-amz-algorithm",
"value": "AWS4-HMAC-SHA256",
"description": ""
},
{
"key": "x-amz-credential",
"value": "AKIATXLS7OEUTX2SL4YJ/20190712/us-west-1/s3/aws4_request",
"description": ""
},
{
"key": "x-amz-date",
"value": "20190712T122443Z",
"description": ""
},
{
"key": "x-amz-signature",
"value": "33d0bb590dc254ccc1bc232e76cbb78679804c7f815bcf55473695867dadb4b8",
"description": ""
},
{
"key": "Filename",
"value": "TestValue",
"description": ""
},
{
"key": "file",
"value": "",
"description": "",
"type": "file"
}
]
},
"description": "Upload file to s3 storate via presigned form"
},
"response": []
}
]
}