File Upload - Presigned URL
POST/api/inspect/v1/file/upload/presigned
This endpoint generates a presigned URL that allows users to upload a file directly to the cloud storage service. The presigned URL is valid for 15 minutes and must be used within this timeframe to upload the file. The response will return a fileID
and the presigned URL. Ensure that the Content-Type
header in the upload request matches the contentType
provided in the request body when generating the presigned URL.
Here is an example of how to use the presigned URL to upload a file using curl
:
curl -X PUT -H "Content-Type: image/png" --upload-file /path/to/your/file.png "https://your-presigned-url"
This method is ideal for large file uploads, as the file is uploaded directly to cloud storage without passing through the backend. Be sure to follow up with a request to mark the file as uploaded using the Complete File Upload endpoint after a successful upload.
Request
- application/json
Body
required
The SHA256 hash of the file, encoded in base64. This hash is used to verify the integrity of the file during the upload process. By providing the hash, the system can check that the uploaded file matches the original file.
Example of calculating the SHA256 hash in base64 on Linux:
sha256sum /path/to/your/file.png | awk '{print $1}' | xxd -r -p | base64
This command will output the SHA256 hash of the file and convert it into base64, which should be passed as the hash value.
The original name of the file. This helps track and manage files by their original names in the cloud system.
The size of the file in bytes. This ensures that the file size falls within any limits that the system might have for file uploads.
The unique identifier (UUID) of the asset to which the uploaded file belongs. This helps link the uploaded file to a specific asset for future reference.
The MIME type of the file to be uploaded (e.g., image/png
, application/pdf
). This value must be included when requesting a presigned URL and should match the Content-Type
header used when uploading the file via the presigned URL.
Responses
- 200
- 201
- 400
- 401
- 403
- 404
- 500
200 OK. The file has already been uploaded, and only the file's unique identifier (id) is returned. The response includes the following data:
- application/json
- Schema
- Example (from schema)
Schema
data
Details of the uploaded file.
The unique identifier (UUID) assigned to the uploaded file. This can be used to reference the file in future operations, such as creating spot attachment or marking it as fully uploaded or retrieving it later.
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}
201 Created. The presigned URL for uploading the file was successfully generated. The response includes the following data:
- application/json
- Schema
- Example (from schema)
Schema
data
Details of the presigned URL for file upload.
The unique identifier (UUID) assigned to the file. This is used to reference the file when marking it as uploaded after using the presigned URL.
The presigned URL for uploading the file. This URL is used to upload the file directly to cloud storage. Ensure that the Content-Type
in the upload request matches the contentType
specified when requesting the presigned URL.
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"presignedURL": "string"
}
}
400 Bad Request. The request is invalid. This may occur if required parameters are missing or invalid. Ensure that all required parameters are included and valid.
- application/json
- Schema
- Example (from schema)
Schema
A code representing the specific error that occurred. This can be used to programmatically identify and handle the error.
A detailed description of the error, providing more context or information about what went wrong. This is intended to help understand the cause of the error and how to resolve it.
{
"error": "Forbidden",
"errorDescription": "permission denied"
}
401 Unauthorized. Authentication is required and was not provided or is invalid. Ensure that the correct credentials or tokens are included in the request.
- application/json
- Schema
- Example (from schema)
Schema
A code representing the specific error that occurred. This can be used to programmatically identify and handle the error.
A detailed description of the error, providing more context or information about what went wrong. This is intended to help understand the cause of the error and how to resolve it.
{
"error": "Forbidden",
"errorDescription": "permission denied"
}
403 Forbidden. The client does not have permission to perform this action. This might happen if the client lacks the necessary privileges to interact with the specified entity.
- application/json
- Schema
- Example (from schema)
Schema
A code representing the specific error that occurred. This can be used to programmatically identify and handle the error.
A detailed description of the error, providing more context or information about what went wrong. This is intended to help understand the cause of the error and how to resolve it.
{
"error": "Forbidden",
"errorDescription": "permission denied"
}
404 Not Found. The specified entity does not exist. Verify that the reference given is correct and that the entity is available.
- application/json
- Schema
- Example (from schema)
Schema
A code representing the specific error that occurred. This can be used to programmatically identify and handle the error.
A detailed description of the error, providing more context or information about what went wrong. This is intended to help understand the cause of the error and how to resolve it.
{
"error": "Forbidden",
"errorDescription": "permission denied"
}
500 Internal Server Error. An error occurred on the server while processing the request. Retry the operation or contact support if the issue persists.
- application/json
- Schema
- Example (from schema)
Schema
A code representing the specific error that occurred. This can be used to programmatically identify and handle the error.
A detailed description of the error, providing more context or information about what went wrong. This is intended to help understand the cause of the error and how to resolve it.
{
"error": "Forbidden",
"errorDescription": "permission denied"
}