QBusiness / Client / get_media

get_media#

QBusiness.Client.get_media(**kwargs)#

Returns the image bytes corresponding to a media object. If you have implemented your own application with the Chat and ChatSync APIs, and have enabled content extraction from visual data in Amazon Q Business, you use the GetMedia API operation to download the images so you can show them in your UI with responses.

For more information, see Extracting semantic meaning from images and visuals.

See also: AWS API Documentation

Request Syntax

response = client.get_media(
    applicationId='string',
    conversationId='string',
    messageId='string',
    mediaId='string'
)
Parameters:
  • applicationId (string) –

    [REQUIRED]

    The identifier of the Amazon Q Business which contains the media object.

  • conversationId (string) –

    [REQUIRED]

    The identifier of the Amazon Q Business conversation.

  • messageId (string) –

    [REQUIRED]

    The identifier of the Amazon Q Business message.

  • mediaId (string) –

    [REQUIRED]

    The identifier of the media object. You can find this in the sourceAttributions returned by the Chat, ChatSync, and ListMessages API responses.

Return type:

dict

Returns:

Response Syntax

{
    'mediaBytes': b'bytes',
    'mediaMimeType': 'string'
}

Response Structure

  • (dict) –

    • mediaBytes (bytes) –

      The base64-encoded bytes of the media object.

    • mediaMimeType (string) –

      The MIME type of the media object (image/png).

Exceptions

  • QBusiness.Client.exceptions.ResourceNotFoundException

  • QBusiness.Client.exceptions.InternalServerException

  • QBusiness.Client.exceptions.LicenseNotFoundException

  • QBusiness.Client.exceptions.MediaTooLargeException

  • QBusiness.Client.exceptions.ThrottlingException

  • QBusiness.Client.exceptions.ValidationException

  • QBusiness.Client.exceptions.AccessDeniedException