curl --request POST \
--url https://api.example.com/api/upload_file \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"room_id": "<string>"
}
'{
"200": {},
"400": {},
"401": {},
"403": {},
"500": {},
"message": "<string>",
"file_url": "<string>"
}Upload a file to a chat room
curl --request POST \
--url https://api.example.com/api/upload_file \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"room_id": "<string>"
}
'{
"200": {},
"400": {},
"401": {},
"403": {},
"500": {},
"message": "<string>",
"file_url": "<string>"
}multipart/form-data.
curl -X POST https://api.example.com/api/upload_file \
-H "Authorization: your-auth-token" \
-F "file=@/path/to/your/file.pdf" \
-F "room_id=room123"
{
"message": "File uploaded successfully",
"file_url": "https://storage.example.com/uploads/file123.pdf"
}
{
"error": "Invalid token or token missing"
}
{
"error": "No file provided"
}
{
"error": "File size exceeds the 24MB limit"
}
{
"error": "You are not a member of this room"
}
{
"error": "File upload failed: <error details>"
}