Quickly test your AWS API Gateway with Postman
Tags: serverless, testing, productivity, aws
Published: 2019-10-24 19:37:27

---
title: Quickly test your AWS API Gateway with Postman
published: true
description: How to export your RESTful API from API Gateway and import it as collection in Postman for quick and easy testing of all your endpoints.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/tbbouew0v0nhzrh7esyk.jpeg
tags: #serverless, #testing, #productivity,#aws
---


As I wrote in [this post](https://dev.to/dvddpl/tools-i-wish-i-knew-from-the-start-48kl) and discussing about [becoming a 10X Developer](https://dev.to/dvddpl/what-makes-a-10x-developer--1k0f), 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](https://learning.getpostman.com/docs/postman/mock_servers/intro_to_mock_servers/) and writing [Test Suites](https://www.getpostman.com/automated-testing) - 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](https://dev.to/dvddpl/the-biggest-advice-i-could-give-to-another-developer-3jme). 


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.

![wow!](https://media.giphy.com/media/5VKbvrjxpVJCM/giphy.gif)

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](https://swagger.io/tools/swaggerhub/opensource-comparison/?utm_source=aw&utm_medium=ppcs&utm_campaign=brand-swagger&utm_content=trial&utm_term=swagger%20api&gclid=EAIaIQobChMI8Ief__u05QIVAqqaCh2xkQlmEAAYASAAEgKpHfD_BwE) ( another cool tool I used some years ago) and **Postman Extension**

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rwvbwmeavhov9qqvpxrz.png)

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. 

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/62dy4jhnkri9737jfzlq.png)

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

```
aws apigateway get-export --parameters extensions='apigateway' --rest-api YOUR_API_ID --stage-name YOUR_STAGE --export-type swagger  YOUR_AWESOME_API_COLLETION.json
```

More about that [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-export-api.html)

----

Photo by [ZACHARY STAINES](https://unsplash.com/@zaccastravels?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on Unsplash