Method: media.upload

첨부파일을 업로드합니다. 예를 보려면 첨부파일로 미디어 업로드를 참조하세요. 사용자 인증이 필요합니다.

첨부파일은 최대 200MB까지 업로드할 수 있습니다. 특정 파일 형식은 지원되지 않습니다. 자세한 내용은 Google Chat에서 차단하는 파일 형식을 참고하세요.

HTTP 요청

  • 미디어 업로드 요청을 위한 업로드 URI:
    POST https://chat.googleapis.com/upload/v1/{parent=spaces/*}/attachments:upload
  • 메타데이터 전용 요청용 메타데이터 URI:
    POST https://chat.googleapis.com/v1/{parent=spaces/*}/attachments:upload

URL은 gRPC 트랜스코딩 구문을 사용합니다.

경로 매개변수

매개변수
parent

string

필수 항목입니다. 첨부파일이 업로드된 Chat 스페이스의 리소스 이름입니다. 'spaces/{space}' 형식을 지정합니다.

요청 본문

요청 본문에는 다음과 같은 구조의 데이터가 포함됩니다.

JSON 표현
{
  "filename": string
}
입력란
filename

string

필수 항목입니다. 첨부파일의 파일 이름(파일 확장자 포함)

응답 본문

첨부파일 업로드에 대한 응답입니다.

성공할 경우 응답 본문에 다음 구조의 데이터가 포함됩니다.

JSON 표현
{
  "attachmentDataRef": {
    object (AttachmentDataRef)
  }
}
입력란
attachmentDataRef

object (AttachmentDataRef)

업로드된 첨부파일에 대한 참조입니다.

승인 범위

다음 OAuth 범위 중 하나가 필요합니다.

  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.messages.create
  • https://www.googleapis.com/auth/chat.messages

자세한 내용은 승인 가이드를 참조하세요.