This API endpoint allows users to upload a file with its metadata. Note that this example assumes the file metadata is being sent in JSON format rather than the actual file content. You will need to modify the endpoint to handle the actual file content as well.
POST http://localhost:3000/files/upload
Authorization: Bearer <access_token>Content-Type: application/jsonfile (object, required): The file object containing metadata.
name (string, required): The file name, including the file extension.size (integer, required): The file size in bytes.type (string, required): The MIME type of the file.
{
"file": {
"name": "test.png",
"size": 100000,
"type": "image/png"
}
}
curl --location '<http://localhost:3000/files/upload>' \\
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE2Nzk5NjYyODZ9.WQ3VQvq0YehJk2f-vDqOYe-5BqWz35nPWyNx5A0O-q0' \\
--header 'Content-Type: application/json' \\
--data '{
"file": {
"name": "test.png",
"size": 100000,
"type": "image/png"
}
}'
201 Createdapplication/json
{
"presigned_url": "https://...."
}
400 Bad Requestapplication/json