:doc:`QBusiness <../../qbusiness>` / Client / get_media

*********
get_media
*********



.. py:method:: 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 <https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/extracting-meaning-from-images.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/qbusiness-2023-11-27/GetMedia>`_  


  **Request Syntax**
  ::

    response = client.get_media(
        applicationId='string',
        conversationId='string',
        messageId='string',
        mediaId='string'
    )
    
  :type applicationId: string
  :param applicationId: **[REQUIRED]** 

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

    

  
  :type conversationId: string
  :param conversationId: **[REQUIRED]** 

    The identifier of the Amazon Q Business conversation.

    

  
  :type messageId: string
  :param messageId: **[REQUIRED]** 

    The identifier of the Amazon Q Business message.

    

  
  :type mediaId: string
  :param mediaId: **[REQUIRED]** 

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

    

  
  
  :rtype: 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**
  
  *   :py:class:`QBusiness.Client.exceptions.InternalServerException`

  
  *   :py:class:`QBusiness.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`QBusiness.Client.exceptions.LicenseNotFoundException`

  
  *   :py:class:`QBusiness.Client.exceptions.MediaTooLargeException`

  
  *   :py:class:`QBusiness.Client.exceptions.ThrottlingException`

  
  *   :py:class:`QBusiness.Client.exceptions.ValidationException`

  
  *   :py:class:`QBusiness.Client.exceptions.AccessDeniedException`

  