We are excited to present you yet another extension to our Flowdock APIs: uploading, listing and downloading files through the Flowdock REST API.
Uploading a file
The REST API supports two ways of attaching files: encoding them with Base64 in a JSON request or sending them as form data. The details of both approaches are described in the new Files page of the API documentation.
Here’s a quick
curl example of using
multipart/form-data to upload a file:
curl -v -X POST -F "event=file" -F "content=@path/to/file.png" https://BASIC-AUTH@api.flowdock.com/flows/ORG/FLOW/messages
Messages containing files can be fetched by filtering messages by the
file event or the
:file tag. The difference is that filtering by the
:file tag will match any type of message that contains files, eg. team inbox messages with attachments.
For example, here’s how you would fetch the 10 latest files uploaded to your flow:
Downloading a file
Once you’ve got some messages with files attached to them, you will probably want to download them for viewing as well. The REST API path of a file is stored in the
path field of each attachment. For reference, see the file message section of Message Types documentation.
The path can be used to download the file by appending it to the API URL
That’s all for now, stay tuned for more API updates!