Creates an attachment for an RCS for Business agent. This method supports direct media uploads and multipart uploads.
The agent developer provides the binary of the file to be uploaded.
To upload a file binary, make an HTTP POST request to the Upload URI and specify the binary as the POST request body. For example, use the --upload-file cURL flag with the fully qualified file path of the binary file.
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
uploadType |
string |
Specifies the type of upload. Supported values are media for direct file upload and multipart for uploading file and metadata together. |
Yes |
attachmentOperationSource |
enum |
Required if uploadType=media. Specifies the reason for the upload. See AttachmentOperationSource for possible values. |
Only for media |
Request body
The structure of the request body depends on the uploadType query parameter.
If uploadType=media:
- The request body must contain only the raw file bytes.
- The
Content-Typeheader must be set to the MIME type of the file. Note: Only PDFs are supported. - The
attachmentOperationSourcemust be provided as a query parameter.
If uploadType=multipart:
- The request body must be formatted as
multipart/form-data. - The request must contain two parts:
- Metadata: A JSON object containing the upload metadata. This part must include the
attachmentOperationSource. - File: The raw file bytes.
- Metadata: A JSON object containing the upload metadata. This part must include the
HTTP request
- Upload URI, for media upload requests:
POST https://businesscommunications.googleapis.com/upload/v1/{parent=brands/*/agents/*}/attachments - Metadata URI, for metadata-only requests:
POST https://businesscommunications.googleapis.com/v1/{parent=brands/*/agents/*}/attachments
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
parent |
Required. The unique identifier of the agent. If the brand identifier is "1234" and the agent identifier is "5678", this parameter resolves to "brands/1234/agents/5678". |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{
"attachmentOperationSource": enum ( |
| Fields | |
|---|---|
attachmentOperationSource |
Required. The source that triggered the attachment upload. |
Response body
An attachment resource with a unique name that an agent can use to identify the attachment.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "name": string, "gcsUrl": string, "displayName": string, "description": string, "contentType": string, "sizeBytes": string, "attachmentOperationSource": enum ( |
| Fields | |
|---|---|
name |
Output only. The unique identifier of the attachment. Read-only. Defined by the platform. |
gcsUrl |
Output only. The GCS URL of the attachment. This is the publicly accessible URL that is used to fetch the attachment from GCS. |
displayName |
Optional. Display name of the attachment. |
description |
Optional. Text description of the attachment's content. Screen readers use this description to help users with disabilities understand what the attachment contains. |
contentType |
Optional. The content type of the attachment. |
sizeBytes |
Output only. Size in bytes of the attachment. |
attachmentOperationSource |
Required. The source that triggered the attachment upload. Specifies the reason for the upload. See |
uploadTime |
Output only. The time when the attachment was uploaded to GCS. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
uploadError |
Output only. Error result, if any, that occurred during the attachment upload. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/businesscommunications
For more information, see the OAuth 2.0 Overview.
AttachmentOperationSource
List of Attachment Operation Sources.
| Enums | |
|---|---|
ATTACHMENT_OPERATION_SOURCE_UNSPECIFIED |
Attachment Operation is unspecified |
VERIFICATION_PAGE |
Console verification page. |
VERIFICATION_ATTACHMENT_VIA_BC_API |
Supporting attachment for agent verification, uploaded using the Business Communications API. |