Appearance
Get AWS S3 signature
About 184 wordsLess than 1 minute
GET /public/v1/form/s3/signature
Query Parameters
| Key | Type | Required | Rule | Description |
|---|---|---|---|---|
| id | string | Mandatory | length 4 | id of the document, randomly generated by front-end |
| content_type | string | Mandatory | content type of document | |
| document | string | Mandatory | document's name | |
| form_id | string | Mandatory | length 8 | form id |
Content Type Values
image/png, image/jpeg, image/bmp, image/vnd.microsoft.icon, image/x-icon, application/pdf, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, text/csv, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/plain, application/gzip, application/x-gzip
Expected HTTP status code
- 200
Response
| Name | Type | Description |
|---|---|---|
| url | string | upload url |
| fields | object | upload details |
| fields.key | string | The doc field to be provided to subsequent API calls. |
Tip
Please refer to Post File using HTML Form and Post File using FormData in Node.js section of this
Upload To S3 Example
const s3Axios = axios.create({
method: 'post',
timeout: 0,
preventUrlCancel: true,
headers: { 'Content-Type': 'multipart/form-data' },
});
let formData = new FormData();
Object.keys(response.fields).forEach((key) => {
formData.append(key, response.fields[key]);
});
formData.append('file', file); // The file to be uploaded
await s3Axios({
url,
data: formData,
}); //The url returned by the API mentioned above.