Test GET from table

Keyboard Shortcuts

Even though a given Lambda function may not be called directly, it is good practice to test its various functions. Learn how to test the POST (from the previous video) and the GET requests. Later you can develop the API and exercise it to call the Lambda. But before that, make sure it works as expected. You can do that via testing.

- [Instructor] In the previous video…we tested posting some data into our new database table.…Now that we hae some data,…let's test the GET in the same way we tested the POST.…So we'll configure a new test event,…we'll specify that it's for a GET,…and then we'll specify the body…based on the code in our Lambda.…So configuring the test event will be very much the same,…but the body will be different.…Once we specify that body, we'll test it.…So looking at our Lambda,…there's two different options…for when we post a GET httpMethod.…

We're gonna use the one that fetches…all of the data from the table.…So we need to get the TableName.…That's the only parameter we need.…And just like we set httpMethod,…we're gonna set the queryStringParameters…and we're gonna specify the TableName in there.…So the body's gonna look a little bit different.…We need to configure a new test event.…So we select the radio button for Create new test event.…This one's gonna be called GETTest,…and we're gonna change the HTTP POST to GET.…

Instead of a body,…

Resume Transcript Auto-Scroll

Author

Released

8/24/2018

Learn how to create RESTful APIs the easy way with Amazon Web Services (AWS). The AWS API Gateway allows developers to create custom RESTful APIs with whatever logic, endpoints, format, and code they choose, along with an SDK for the client of choice, such as iOS. You can even wrap another API or call code to return data. In this course, instructor Bear Cahill shows how to create RESTful APIs with the API Gateway, using HTTP requests and AWS Lambda functions to read and write to an AWS DynamoDB. Plus, learn how to use the generated API to create the source code for the client project—an iOS app—with Swagger.