Upload an attachment
/v1/amb/attachmentsbird amb attachments upload --from <from> --file ./document.pdfcurl -X POST "https://us1.platform.bird.com/v1/amb/attachments" \
-H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "b52d6267-2b62-4f8a-8842-0533d0f1dc07",
"source_url": "https://media.example.com/receipt.pdf",
"name": "receipt.pdf",
"mime_type": "application/pdf"
}'{
"id": "aat_01krdgeqcxet5s7t44vh8rt9mg",
"business_account_id": "abz_01krdgeqcxet5s7t44vh8rt9mg",
"origin": "received",
"message_id": "amb_01krdgeqcxet5s7t44vh8rt9mg",
"name": "receipt.pdf",
"mime_type": "application/pdf"
}
Uploads a file to Apple for the business account identified by from
and returns an attachment you can send by attachment_id. Send the file
as multipart/form-data with from and file, at most 25,000,000 bytes;
or supply from and an HTTPS source_url, which Bird downloads, at most
99,999,999 bytes, as JSON or as multipart form fields. Bird encrypts and
uploads the file to Apple before it responds.
The name is name, else the uploaded filename, else the last segment of
the source_url path. The media type is mime_type, else the declared
type of the uploaded file part, else the type Bird detects from the
contents.
Each request uploads a new attachment, even for a file you uploaded
before; retry with the same Idempotency-Key to receive the first
result. expires_at is Bird's estimate of when Apple stops holding the
attachment, 30 days after the upload or the last message that used it.
An unknown from returns 404; a disconnected business account
returns 422.
Corpo da requisição
fromApple business identifier of the business account that sends the attachment. Read it from the business account's apple_business_id. Only this business account can send the attachment.
source_urlHTTPS URL of the file, at most 99,999,999 bytes. Bird downloads it and uploads it to Apple. A non-HTTPS URL is refused with a 422 AMBEndpointNotHTTPS.
nameDisplay filename. Defaults to the last segment of the source_url path.
mime_typeMedia type of the file. Defaults to the type Bird detects from the contents.
Payload de resposta
idSend it as attachment_id.
business_account_idThe business account Apple holds the attachment for.
originHow Bird obtained an attachment:
received: A customer sent it in a message.sent: You sent it in a message bysource_url.uploaded: You uploaded it with createAMBAttachment.
Possible values: received, sent, uploaded
message_idThe message the attachment belongs to.
nameDisplay filename. May be empty for an attachment stored before this release.
mime_typeMedia type of the attachment. May be empty for an attachment stored before this release.
sizeAttachment size in bytes. May be 0 for an attachment stored before this release.
expires_atBird's estimate of when Apple stops holding the attachment, 30 days after it was received, uploaded or last sent. A send within 24 hours of this time is refused.
created_atWhen Bird stored the attachment.
Recursos relacionados
Continue com a documentação, guias e exemplos sobre este tópico.