You should be able to add an attachment when you are posting a message using REST v2. Here's how you do it:
Make a multipart/form-data HTTP POST to the /messages collection. Include your JSON in a request parameter named api.request. Include your attachments in your JSON (in the attachments sub-object, where each attachment is specified as an object in the "items" array. One of the fields of each item you need to include is named field -- you specify the name of an additional request paramer here which is the request parameter of the file you are passing. Here is an example POST:
POST /community/2.0/mytenantid/messages HTTP/1.1
Host: api.lithium.com
Cache-Control: no-cache
Authorization: Bearer c8XWHLqYF0vpgYX4H0UzGZOolN5y+LXWV2bfZUW6QsI=
client-id: CbEwDo2NtAhXLSt4Y49D1yVE9D371eyZFWRSSXvNLvA=
Content-Type: multipart/form-data; boundary=----MyFormBoundary7MA4YWxkTrZu0gW
----MyFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="api.request"
{ "data": { "type": "message", "subject": "here's a post with an attachment", "board": { "type": "board", "id": "studio" }, "attachments": { "list_item_type": "attachment", "items": [ { "type": "attachment", "field": "myattachment", "filename": "myfile.png" } ] } } }
----MyFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="myattachment"; filename="myfile.png"
Content-Type: image/png
----MyFormBoundary7MA4YWxkTrZu0gW
As you can see, my myfile.png file is transmitted in the "myattachment" request parameter, and so the value of the field field in my attachment in the request JSON is "myattachment".
( SuzieH we don't have this documented yet, but we can use this an example when we do)
You can also make REST v1 calls if you are using the API proxy -- see the "URL format with OAuth" section on The API Call page in the REST v1 docs for more information on how to do this.
-Doug