直达内容

Upload Attachments

POST /attachments

To upload an attachment, you must first create a new attachment.

API 端点 URL

 https://api.mixin.one/attachments

授权和其他选项

授权
Authorized
限制No limitation

请求体

{
// Just leave them empty.
"attachment_id": "",
"upload_url": "",
"view_url": "",
}

请求示例

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/attachments --data PAYLOAD
attachment data
{
"data": {
"type": "attachment",
"attachment_id": "7a54e394-1626-4cd4-b967-543932c2a032",
// the url to view the attachment
"view_url": " ... ",
// the url to upload the attachment
"upload_url": " ... ",
}
}

Upload the Attachment

You will get the upload_url from the previous response. Now upload the attachment to upload_url, and then the attachment_id can be used sending images, videos, files and other messages.

Mixin Messenger uploads the attachments using HTTP and store them on the Amazon S3, see S3 documentation for more information.

Here is a code snippet to upload an attachment.