Quickly test your AWS API Gateway with Postman

Image for post
Image for post

As I wrote in this post and discussing about becoming a 10X Developer, I love tools that help me become more productive and allow me to avoid repetitive tasks.

Every time I have to implement or debug a RESTful API, my tool of choice is Postman: it allows you many things — like creating Mock servers and writing Test Suites — but most of the times I use it to keep a collection of APIs and quickly edit parameters/ query string / and environment variables for the different stages.

So that if a bug occurs in the client, I can quickly run the request directly in Postman and investigate the issue (especially if the request is the result of a form that is long and boring to reproduce on the client app, I just fill it once, save the payload from Chrome Dev Tools and copy it in Postman and there is no need to fiddle with Input Fields and to click hundred times around anymore).
Then I switch to different stages ( QA-TEst or DEvelopment to see if it happens there as well) and iterate changes and quick testing.

In other words, it really helps in tightening the feedback loop.

Sometimes though, it is still a bit tedious to recreate all the methods of the API and all the Collection in Postman.

Something that we do in our Team is Sharing the collection so that if someone already worked on that API, all others can benefit from his/her set up. But you can also Export your collection and pass it around or version-control it.

Just today though, I found out that you can import in Postman a Collection of your RestAPI directly exported from the Console of AWS Gateway API.

Image for post
Image for post

We use Serverless to describe our architecture and create our endpoint matching different Lambdas, so I rarely go to the UI Console of AWS.

This morning almost by chance I opened the console and clicked under Stages and saw that there are lots of tabs to configure the API.

One of them is named Export and clicking on it you can choose between Swagger ( another cool tool I used some years ago) and Postman Extension

Image for post
Image for post

Just click on Postman, export your json file and import it in Postman: Tadaaa! You will have everything imported nice and tidy and you can immediately start filling all the parameters you need to trigger and test your endpoints.

Image for post
Image for post

Ah. and of course, since I hate clicking around and waste time in a UI console, here you have the oneliner for the terminal.

More about that here

Photo by ZACHARY STAINES on Unsplash

Originally published at https://dev.to on October 24, 2019.

Sport addicted, productivity obsessed, avid learner, travel enthusiast, expat, 2 kids. Technical Lead (NodeJs Serverless)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store