Get aws bucket content listing using Postman – “Get Bucket (Version 2)” RestAPI

Question:

I am using Postman to send the AWS S3 RestAPI “Get Bucket (Version 2)” to get bucket listing.

Name of bucket is “test-bucket-1.ahadomain.com” (ahadomain.com is a dummy nonexistent domain that I used when naming the bucket in aws). The user credentials I am using has all the permissions to make S3 calls. I am following the info on page – http://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html

I am using the endpoint : https://test-bucket-1.s3.us-east-1.amazonaws.com
I am sending the following Headers : Content-Type, Host, X-Amz-Content-Sha256, X-Amz-Date, Authorization

Do I need to add “list-type” as a query parameter or as a header? If as a query parameter, how do I state it in the url.

I am getting the following response, which does not contain a listing of the content, just info about the bucket itself:

Any help would be greatly appreciated.

Thank you,
Ahmed.

Answer:

You can do the following:

  1. Set the method to GET
  2. in the URL: https://s3.amazonaws.com/test-bucket-1.ahadomain.com/?list-type=2
    Note: If the region of your bucket is not in us-east-1, change the s3.amazonaws.com to correct S3 endpoint of that region.
  3. In Authorization tab, set the following:
    a. Type: AWS Signature
    b. AccessKey:
    c. SecretKey:
    d. AWS Region: us-east-1
    Note: change this if this is not the region of your bucket
    e. Service Name: s3
    f. Check “Save helper data to request”
  4. Go to Headers tab, delete all entries if there is any.
  5. Then click “Send” button

Here sample result

Leave a Reply