Getting A List of All Items in S3!

addam davis
3 min readApr 11, 2022

Objective: Create the function to return a list of all items in S3!

When we go to find a case number and we enter the access number, we need to list all the objects that are in our bucket. Once we have gathered the list, we need to check if any match and download the matching object. This is a two-part process. First, generate the list of objects, and second, once we have the object download said object.

Looking at the documentation, Amazon provides a code example of how to list objects as well as download an object.

We are going to download the list of items within the bucket, then compare it against the string entered on the app. If the case exists, we are going to download that object and display the information on the following pages.

When we enter a case number and press the search button on the app we need to then not go to the next page, instead, we need to queue the database. In Unity head to the search panel. On the search button remove the OnClickEvent for enabling the next panel. We are going to take care of it through code.

We are only going to call the process info method through OnClickEvent

In the search panel class, we only have our process info method and an Input Field.

Let’s write out what we want to do with pseudo code.

Looking at the code example for how to download a list of objects, we need to create a request of type List Objects Request. We should write this in the AWS Manager so we can call the method.

Now we create a request.

This is a class, and we need to the constructor

After we create the request, we need to use the client to send the request.

The list of objects is going to be stored in the responseObj. We are now going to use an in-line for each loop to iterate through the list recieved.

Now we can return to the search panel and call this method, and for the ease of this tutorial we are going to hard code a case number to call this method with however, in the next tutorial we will update this.

Hope into Unity and test it. This will print out a list of all the cases we have previously made.

Success! In the next tutorial we are going to compare the string entered with what is on the list. I’ll see you in the next tutorial!