List more than 1000 Buckets with XML API

拜拜、爱过 提交于 2021-02-19 07:33:32

问题


GET Service for listing Buckets

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.

Edit:

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

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>

回答1:


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.

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



来源:https://stackoverflow.com/questions/58057679/list-more-than-1000-buckets-with-xml-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!