列出超过1000个带有XML API的存储桶 [英] List more than 1000 Buckets with XML API

查看:40
本文介绍了列出超过1000个带有XML API的存储桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取用于列出存储桶的服务

使用上面链接中的教程,我可以在我的帐户中列出存储桶.但是,响应仅返回1000个存储桶,我认为这是单个响应的限制.问题是如何列出帐户中剩余的存储桶?对于列出存储桶对象,我们可以添加标记参数以指示从哪个对象继续列出,但是似乎没有列出存储桶的参数.

With the tutorial in the link above, I am able to list Buckets in my account. However, the response only return 1000 Buckets which I believe is the limit for a single response. The problem is how can I list the remaining Buckets in my account? For listing Bucket Objects, we can add the marker param to indicate from which object to continue listing but it seems there is no such param for listing Buckets.

我正在使用HMAC密钥而不是OAuth2进行请求,所以我不能使用JSON API,根据

I am using HMAC keys instead of OAuth2 to make request so I cannot use the JSON API, "HMAC keys can only be used to make requests to the XML API, not the JSON API", according to HMAC keys Restrictions

当前的XML响应,其中不包含标记,游标或pageToken:

Current XML response which doesn't include anything like marker, cursor or pageToken:

<?xml version='1.0' encoding='UTF-8'?>
<ListAllMyBucketsResult
    xmlns='http://doc.s3.amazonaws.com/2006-03-01'>
    <Buckets>
        <Bucket>
            <Name>bucket-1</Name>
            <CreationDate>2019-09-23T07:03:11.892Z</CreationDate>
        </Bucket>
        <Bucket>
            <Name>bucket-2</Name>
            <CreationDate>2019-09-23T07:03:12.578Z</CreationDate>
        </Bucket>
        ...
        <Bucket>
            <Name>bucket-999</Name>
            <CreationDate>2019-09-23T07:03:11.892Z</CreationDate>
        </Bucket>
        <Bucket>
            <Name>bucket-1000</Name>
            <CreationDate>2019-09-23T07:03:12.578Z</CreationDate>
        </Bucket>
  </Buckets>
</ListAllMyBucketsResult>

推荐答案

您可以尝试使用 JSON API的列表方法.使用此方法,只要您的结果超过最大值,就会返回 pageToken 项,您可以将其用作下一个请求的参数,以便对结果进行分页.

You could try using the JSON API's list method. With this method whenever your results are over the maximum a pageToken item will be returned, you can use it as a parameter for your next request in order to paginate through the results.

在实施之前,您可以测试此API 从文档页面开始.

Before implementing it you can test this API from the documentation page.

这篇关于列出超过1000个带有XML API的存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆