GetObject

GetObject #

Overview #

Retrieves objects from Amazon S3.

AWS API Reference: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html

Method #

GETOBJECT

Import Parameters #

The request uses the following import parameters.

  • i_bucket_name (bucket in AWS) (Required)

    Name of the bucket to create.

  • i_region (Required)

    AWS Region of the Amazon S3 Bucket.

  • i_key(Key in AWS)

    Key of the object to get.

  • i_part_number(partNumber in AWS)

    Part number of the object being read.

  • i_response_cache_control (response-cache-control in AWS)

    Sets the Cache-Control header of the response.

  • i_response_content_disposition (response-content-disposition in AWS)

    Sets the Content-Disposition header of the response.

  • i_response_content_encoding (response-content-encoding in AWS)

    Sets the Content-Encoding header of the response.

  • i_response_content_language (response-content-language in AWS)

    Sets the Content-Language header of the response.

  • i_response_content_type (response-content-type in AWS)

    Sets the Content-Type header of the response.

  • i_response_expires (response-expires in AWS)

    Sets the Expires header of the response.

  • i_versionid (versionId in AWS)

    VersionId used to reference a specific version of the object.

  • i_if_match (If-Match in AWS)

    Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).

  • i_if_modified_since (If-Modified-Since in AWS)

    Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).

  • i_if_none_match (If-None-Match in AWS)

    Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).

  • i_if_unmodified_since (If-Unmodified-Since in AWS)

    Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).

  • i_range (Range in AWS)

    Downloads the specified range bytes of an object.

  • i_x_amz_expected_b_owner (x-amz-expected-bucket-owner in AWS)

    The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

  • i_x_amz_request_payer (x-amz-request-payer in AWS)

    Confirms that the requester knows that they will be charged for the request.

  • i_x_amz_server_custom_algorit (x-amz-server-side-encryption-customer-algorithm in AWS)

    Specifies the algorithm to use to when encrypting the object (for example, AES256).

  • i_x_amz_server_custom_key (x-amz-server-side-encryption-customer-key in AWS)

    Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data.

  • i_x_amz_server_custom_key_md5 (x-amz-server-side-encryption-customer-key-MD5 in AWS)

    Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321.


Export Parameters #

This method use the following export parameters:

  • e_http_status

    HTTP Status code.

  • e_response_headers

    Returns information about the request in format Name/Value pair values.

  • e_response_content

    Response content in string format.

  • e_response_xcontent

    Response content in xstring format.


Example #

DATA: lo_s3                 TYPE REF TO /lnkc/cl_sdk_aws_s3,
      lv_http_status        TYPE i,
      lt_response_headers   TYPE tihttpnvp,
      lv_response_content   TYPE string,
      lv_response_xcontent  type xstring.

  TRY.
      CREATE OBJECT lo_s3
        EXPORTING
          i_user_name         = 'user_awsconnector'
          i_access_key        = 'acces_key_value'
          i_secret_access_key = 'secret_acceskey_value'.
  ENDTRY.


  TRY.
        CALL METHOD lo_s3->getobject
          EXPORTING
            i_bucket_name                 = 'i_bucket_name'
            i_region                      = 'i_region'
            i_key                         = 'i_key'
*           i_part_number                 =
*           i_response_cache_control      =
*           i_response_content_disposition =
*           i_response_content_encoding   =
*           i_response_content_language   =
*           i_response_content_type       =
*           i_response_expires            =
            i_versionid                   = 'i_versionid'
*           i_if_match                    =
*           i_if_modified_since           =
*           i_if_none_match               =
*           i_if_unmodified_since         =
*           i_range                       =
            i_x_amz_expected_b_owner      = 'i_x_amz_expected_b_owner¡
            i_x_amz_request_payer         = 'i_x_amz_request_payer'
            i_x_amz_server_custom_algorit = 'i_x_amz_server_custom_algorit'
            i_x_amz_server_custom_key     = 'i_x_amz_server_custom_key'
            i_x_amz_server_custom_key_md5 = 'i_x_amz_server_custom_key_md5'
          IMPORTING
            e_http_status                 = lv_http_status
            e_response_headers            = lt_response_headers
            e_response_content            = lv_response_content
            e_response_xcontent           = lv_response_xcontent.      
        
      CATCH /lnkc/cx_sdk_aws .
        " Error Message
  ENDTRY.