KB Article #181649

RESTAPI: Send an AdHoc message with a link

Problem

How to create and send a mail with link using SecureTransport's API?


Resolution

Creating and sending an Ad Hoc message is a three-step process.


Create a draft message

curl -k -u USERNAME:PASSWORD -X POST "https://IP_OR_HOSTNAME/api/v1.4/mailbox/messages" -H "csrfToken: " -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "to=RECIPIENTEMAIL&subject=MESSAGESUBJECT&message=MESSAGEBODY&security=ANONYMOUS_LINK"



Attach a file to the draft message

curl -k -u USERNAME:PASSWORD -X POST "https://IP_OR_HOSTNAME/api/v1.4/mailbox/messages/b0d92a4d1bbb4e15a962b92ced8bddfa/attachments" -H "csrfToken: " -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@FILENAME"


where b0d92a4d1bbb4e15a962b92ced8bddfa is the messageID taken from the response of the first API call.



Send the message

curl -k -u USERNAME:PASSWORD -X PUT "https://IP_OR_HOSTNAME/api/v1.4/mailbox/messages/b0d92a4d1bbb4e15a962b92ced8bddfa/send" -H "csrfToken: " -H "accept: application/json"