HeadObject

HeadObject #

The HEAD operation retrieves metadata from an object without returning the object itself. To Use HEAD, you must have READ access to the object.

Overview #

You need the s3:GetObject permission for this operation.

For more information: https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html

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

Method #

HEADOBJECT

Import Parameters #

The request uses the following import parameters.

  • i_bucket_name (Required)

    Name of the bucket to create. The final name will be the result of concatenate SAP system ID + ‘_’ + i_bucket_name

    Example

    SID: ‘LNK’ + i_bucket_name: ‘test’ => LNK_test.

    • **x-amz-expected-bucket-owner

    The account id of the expected bucket owner

  • i_region (Required)

    AWS Region of the Amazon S3 Bucket.

  • i_key (key in AWS) (Required)

    The object key.

  • i_part_number (partNumber in AWS)

    Part number of the object being read.

  • 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_versionid (versionId in AWS)

    VersionId used to reference a specific version of the object.

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

    The account id of the expected bucket owner.

  • 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. Returns 200 if no errors found.

  • e_response_headers

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

  • e_response_content

    Response content in string format.


Example #

DATA: lv_bucket             TYPE         /lnkaws/bucket,
      lo_aws_s3_bucket      TYPE REF TO  /lnkaws/cl_aws_s3_bucket,
      lo_cx_aws_s3          TYPE REF TO  /lnkaws/cx_aws_s3,
      lv_http_status        TYPE         i,
      lt_response_headers   TYPE         tihttpnvp,
      lv_response_content   type         string.


TRY.
        CALL METHOD lo_s3->headobject
          EXPORTING
            i_bucket                      = '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.
    CATCH /lnkaws/cx_aws_s3 INTO lo_cx_aws_s3.
ENDTRY.