GET https://api.groovehq.com/v1/attachments
Name | Type | Required | Notes |
---|---|---|---|
message | string | Yes | The ID of the message to list attachments for |
Status: 200 OK
{
"attachments": [{
"filename": "an-attachment.pdf",
"size": 100249,
"url": "http://bucket-name.s3.amazonaws.com/?1429889868",
}]
}
POST https://uploader.groovehq.com/messages/:message_id/attachments
Uploading attachments to a message is handled through the Groove uploader API. This API uses the same authentication as the core Groove API, but it is located at:
https://uploader.groovehq.com instead of https://api.groovehq.com.
The attachments endpoint is polymorphic and can understand both single binary file uploads as well as multipart/form-data uploads (allowing for multiple files in a single request).
Because this endpoint supports multiple files, it will always do its best to fulfill as many file uploads as possible. You should always check the success boolean and errors array of each response object.
POST https://uploader.groovehq.com/messages/:message_id/attachments
Content-Type is defined by binary
You can send a single binary file, which is supported by most clients.
Name | Type | Required | Notes |
---|---|---|---|
filename | string | Yes | The name of the file being uploaded |
curl "https://uploader.groovehq.com/messages/4517239960/attachments?filename=image.jpg" \
-H "Authorization: Bearer 41529cf5de0f4daa10098ff4881521c0cfea8b127d8e11bc5cc2cadb974e9a72" \
-H "Content-Type: image/jpeg" \
--data-binary @./samples/image.jpg \
-X POST
Status: 200 OK
{
"attachment": {
"attachment_file_name": "image.jpg",
"attachment_content_type": "image/jpeg",
"attachment_file_size": 32768,
"success": true
}
}
Status: 200 OK
{
"attachment": {
"attachment_file_name": "image.jpg",
"attachment_content_type": "image/jpeg",
"attachment_file_size": 20971520,
"success": false,
"errors": [
"Filesize exceeded maximum limit of 20971520 bytes"
]
}
}
POST https://uploader.groovehq.com/messages/:message_id/attachments
Content-Type must be multipart/form-data
Multiple files may be uploaded in the same request by submitting the request as a multipart/form-data. As stated before, the endpoint will try to upload as many files as it can, and will return attachments with success and errors fields that you should check.
curl -X POST \
-H "Authorization: Bearer 41529cf5de0f4daa10098ff4881521c0cfea8b127d8e11bc5cc2cadb974e9a72" \
-F "file=@./samples/image.jpg" \
-F "file=@./samples/data.xml" \
"https://uploader.groovehq.docker/messages/4517239960/attachments"
Status: 200 OK
{
"attachments": [
{
"attachment_file_name": "image.jpg",
"attachment_content_type": "image/jpeg",
"attachment_file_size": 32768,
"success": true
},
{
"attachment_file_name": "data.xml",
"attachment_content_type": "application/xml",
"attachment_file_size": 20971520,
"success": false,
"errors": [
"Filesize exceeded maximum limit of 20971520 bytes"
]
}
]
}
GET https://uploader.groovehq.com/messages/:message_id/attachments/remaining
Because our api limits messages to 25 attachments, you should check to make sure there are enough attachments remaining for the number of files you are preparing to upload.
Status: 200 OK
{
"remaining_attachments_count": 12
}