List Messages and Download Attachments
This API call views messages others have sent to you. When viewing the available messages, you can view the list if available messages, or view an individual message. Viewing the individual message will also view the files attached to the message.
Viewing available Messages
Request Info & Parameters
Info | Value |
---|---|
Request URL | /messages/inbox |
Request VERB | GET |
Parameter | Type | Description |
---|---|---|
sent_after | Date | List messages sent after YYYY-MM-DD |
sent_in_the_last | Integer | List messages sent in the last X number of hours |
Response
Parameter | Type | Description |
---|---|---|
id | String | The message ID. |
sender | String | The sender of the message. |
recipients | Array | All the specified recpients. |
ccs | Array | All the cc'd recipients. |
created_at | Datetime | When the message was created. |
expires_at | Date | When the message expires. |
authorization | Integer |
|
authorization_description | String | The description of the authorization. |
subject | String | The subject of the message. |
size | Integer | The number of total bytes in the message. |
attachments | array | All attachments to this message with the following individual parameters:
|
Example using curl
curl -s -X GET --user "$api_key:x" -H "Accept: application/json" -H "Content-Type: application/json" https://test.host/messages/inbox?sent_in_the_last=24 {"messages": [ { "id":"1p4EHkeNzM5b2qO7kyNEIy", "sender":"user@example.com", "recipients":["user@example.com"], "expires_at":"2011-07-23", "expires_after":0, "authorization":3, "authorization_description":"Only Specified Recipients can access", "size":53516, "subject":"test subject", "message":"Test Message", "private_message":false, "ccs":[], "url":"https://www.example.com/message/1p4EHkeNzM5b2qO7kyNEIy", "created_at":"2011-07-09 06:51:07", "attachments":[ { "id":"fHbIuSIou38Txc0jVrobEp", "filename":"176638.strip.gif", "size":53516, "content_type":"image/gif", "checksum":"07dc261df7ff3f428e1f115dfde91ecccd83c9ebb896962918de5a56272141ad", "crc32":"acb7c906", "created_at":"2011-07-09 06:51:07", "url":"https://www.example.com/message/lLIpq63PmFuIGCtmEsl3JG/fHbIuSIou38Txc0jVrobEp/ddMilLfDbOvo4QlzttYMlT/176638.strip.gif" } ] } ] }
Viewing a message
If you know the message ID (listed above), you can view an individual message.
Info | Value |
---|---|
Request URL | /message/message_id |
Request VERB | GET |
Parameter | Type | Description |
---|---|---|
message_id | String | The message id |
The response parameters are the same as when listing all messages (above) and will only return one message.
Example using Curl
curl -s -X GET --user "$api_key:x" -H "Accept: application/json" -H "Content-Type: application/json" https://test.host/message/1p4EHkeNzM5b2qO7kyNEIy {"messages": { "id":"1p4EHkeNzM5b2qO7kyNEIy", "sender":"user@example.com", "recipients":["user@example.com"], "expires_at":"2011-07-23", "expires_after":0, "authorization":3, "authorization_description":"Only Specified Recipients can access", "size":53516, "subject":"test subject", "message":"Test Message", "private_message":false, "ccs":[], "url":"https://www.example.com/message/1p4EHkeNzM5b2qO7kyNEIy", "created_at":"2011-07-09 06:51:07", "attachments":[ { "id":"fHbIuSIou38Txc0jVrobEp", "filename":"176638.strip.gif", "size":53516, "content_type":"image/gif", "checksum":"5c59ef6f86b878cac23fee21498e192d2247d988", "crc32":"acb7c906", "created_at":"2011-07-09 06:51:07", "url":"https://www.example.com/message/lLIpq63PmFuIGCtmEsl3JG/fHbIuSIou38Txc0jVrobEp/ddMilLfDbOvo4QlzttYMlT/176638.strip.gif" } ] } }
In this example, there's one available attachment. Using the URL, you can download the file. Again, using curl:
curl -s -X GET --user "$api_key:x" -H "Accept: application/json" -H "Content-Type: application/json" https://test.host/message/1p4EHkeNzM5b2qO7kyNEIy/ZfYoatTMcYQLX0qUutOate/A3ohjLyybRyFMj9x65KbzE/secret_image.jpg
Please note that the URL is a one time URL and it will expire after the file has been downloaded. It's not possible to link to individual files without viewing the message.