如何将 AWS S3 REST API ListObjects(v2) 与多个父/子存储桶目录一起使用?

eri*_*ine 4 rest amazon-s3 amazon-web-services postman

我在这里缺少什么?

我可以使用aws cli以下命令毫无问题地列出对象:

aws s3 ls s3://bucket.mycompany.com/parent-dir1/parent-dir2/

但是通过 Postman 使用 REST API,等效请求会返回空响​​应。

  • 工具:邮递员
  • 方法:获取
  • 网址:
    • https://bucket.mycompany.com.s3.amazonaws.com/parent-dir1/parent-dir2/?list-type=2
  • 授权: 在此输入图像描述
  • 标题:
    • 我尝试过没有标题和x-amz-content-sha256 UNSIGNED-PAYLOAD
    • 当我尝试使用此标头时,消息显示“这是重复的标头,将被覆盖...” 在此输入图像描述
  • 回复:
  • Status 200但响应为空(中有很多文件parent-dir2)。

在此输入图像描述 在此输入图像描述

eri*_*ine 6

尤里卡!在 AWS 文档中找到了答案

最终获胜者是:

  • https://bucket.mycompany.com.s3.amazonaws.com/?list-type=2&prefix=parent-dir1/parent-dir2/

在此输入图像描述