POST Presigned URL to Upload File
Overview
The following table contains important information about the POST method in regards to the upload process with presigned url.
| POST Method | |
|---|---|
| Method | POST |
| URL or Endpoint | /api/projects/projectId/uploads/url |
| Headers | Authorization |
| Parameters | projectId |
| Body | Check the request body below. |
The description of the URL parameter is as follows:
projectId URL Parameter | |
|---|---|
| URL Parameter Name | projectId |
| Mandatory | Yes |
| Type | string |
| Description | Unique identifier for project |
Request Body
{
"fileName": "{fileName}",
"contentLength": 0,
"mimeType": "{mimeType}",
"contentType": "{contentType}",
"enableDuplicateCheck": false,
"fileHash": "{fileHash}"
}
Information about the fields that appear when you request the body of the video are displayed in the table below.
| Field Name | Mandatory | Type | Description |
|---|---|---|---|
| fileName | Yes | string | Name of the file. |
| mimeType | No | string | Type of the file. |
| contentType | No | string | Content type of the file. |
| contentLength | No | integer | Length of the file (in bytes). |
| enableDuplicateCheck | No | boolean | Determines whether duplicate upload should be disallowed. |
| fileHash | No | string | The hash of the file to be uploaded. Required if enableDuplicateCheck is true. |
If the enableDuplicateCheck field is set to true and fileHash is provided, the system will check for existing files with the same file hash and prevent them from being uploaded again. If set to false or omitted, duplicates will be allowed.
Important: This field should be enabled for both the initial upload and any subsequent uploads. If not enabled initially, the system will not perform the duplicate check, and duplicates will be allowed, even if the file hash is the same.
Response
{
"success": true,
"errors": [],
"messages": [],
"result": {
"uploadFileDetailsId": 0,
"url": "{url}",
"requestKey": "{requestKey}",
"filePath": "{filePath}"
},
"resultInfo": null,
"statusCode": 200
}
Information about the fields that appear when you request the body of the video are displayed in the table below.
| Parameter Name | Type | Description |
|---|---|---|
| success | bool | If the response is successful, it will return true. Otherwise, it will return false. |
| errors | array[string] | Indicates if there was an error. |
| messages | array[string] | Returns the response message from the back-end. |
| result | object | Returns the response object. |
| uploadFileDetailsId | integer($int32) | The ID of upload file details. |
| url | string | The URL where the resource can be accessed. |
| requestKey | string | A unique key associated with the request. |
| filePath | string | The file path of the resource. |
| resultInfo | string | Returns extra information about the result. |
| statusCode | integer($int32) | Returns the HTTP Status Code. |
If the action is successful, the service sends back an HTTP 200 or 201 response.
Errors
For information about the errors that are common to all actions, see Common Errors:
HTTP Status Code 400: Bad Request
HTTP Status Code 401: Unauthorized
HTTP Status Code 403: Forbidden
HTTP Status Code 404: Result Not Found
HTTP Status Code 409: Conflict
{
"success": true,
"errors": [],
"messages": [],
"result": {
"uploadFileDetailsId": "{uploadFileDetailsId}",
"requestKey": "{requestKey}"
},
"resultInfo": null,
"statusCode": 409,
}
HTTP Status Code 410: Gone
HTTP Status Code 500: Internal Server Error
HTTP Status Code 503: Backend Fetch Failed