Quantcast
Channel: Mattermost Discussion Forums - Latest posts
Viewing all articles
Browse latest Browse all 25778

API Docs: File Upload API

$
0
0

Hi @gleblanc1783,

Your code looks good, except you've got a small typo when preparing the file to attach to the request.

    files = {"file": open(file_, 'rb'), "filename": file_} # incorrect

This should have refer to the file you're uploading as "files" since this API route can receive multiple files at once.

    files = {"files": open(file_, 'rb'), "filename": file_} # correct

You'll then get back a filename that you can attach to a Post object when making sending a message.

Also, regarding the Slack compatibility, that's only for our Webhooks and Slash commands. The REST api doesn't try to be compatible with Slack.


Viewing all articles
Browse latest Browse all 25778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>