What does start-after in aws S3 ListObjectsV2 api mean?

Viewed 1241

In the ListObjectsV2 - Amazon Simple Storage Service :

start-after
StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket.

It wasn't clear how is it listed. Is it by the time the file was added? Or by how the was sorted lexicographically?

2 Answers

ListObjectsV2 api, objects are returned sorted in an ascending order of the respective key names in the list. (Not in the order of date)

and StartAfter means, it starts at StartAfter(including the passed key) and returns the keys from that key.

StartAfter means lexicographically after.

You're correct the doc definition is not worded clearly.

But example 3 shows a call with parameter start-after=ExampleGuide.pdf:

GET /?list-type=2&max-keys=3&prefix=E&start-after=ExampleGuide.pdf HTTP/1.1
Host: quotes.s3.<Region>.amazonaws.com
x-amz-date: 20160430T232933Z
Authorization: authorization string

And the docs explain the behavior as follows:

the request [will] retrieve up to three keys in the quotes bucket that start with E and occur lexicographically after ExampleGuide.pdf.

Related