# The lazy dev's guide to API automation: Airtable to SurveyMonkey uploader

The first [Postman conference](https://www.postman.com/post-con) is coming up soon, and there’s so much to do! We’re hosting a pre-conference workshop where Postman users can level up ? their Postman game and take a quiz to get certified as a Postman expert.  The Postman team came up with quiz questions on a shared spreadsheet, and we whittled and wordsmithed our way to a final list of questions. We planned to use SurveyMonkey to administer the quiz, so I created a survey, entered the first question, entered all the answers, configured the display options, and then selected the right answers.  ![](https://assets.postman.com/postman-docs/lazycat.jpg) It's widely known that developers are a lazy group. I did not want to spend more time painstakingly entering in each question by hand. There had to be an easier way to do this!### **Pulling records with the Airtable API**

 I’d worked with the spreadsheet app [Airtable](https://airtable.com/) before, and knew it had [an easy API](https://airtable.com/api) to access my data. I copied and pasted the quiz data into an Airtable base and added some formulas to format the data the way I wanted. I can’t give away the answers to the Postman quiz! So here’s [another example base](https://airtable.com/shry9zUrZ2gacyYQf): ![](https://assets.postman.com/postman-docs/airtable_base.png) For the authorization, add your Airtable API key as an [environment variable](https://learning.postman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/) called `airtable_api_key` under the environment editor. To generate or manage your API key, visit your [Airtable account](https://airtable.com/account) page. ![](https://assets.postman.com/postman-docs/airtable_docs.png) The first request in my [Postman collection](https://learning.postman.com/docs/postman/collections/intro_to_collections/) is to `GET` all airtable records from this base. Make sure to update your `airtable_base` in the environment editor the way you did with your API key. Let’s store this information by parsing the response and setting an environment variable called `airtable_records` under the **Tests** tab. ![](https://assets.postman.com/postman-docs/airtable_test.png)### **Uploading questions with the SurveyMonkey API**

 I turned to the [SurveyMonkey API documentation](https://developer.surveymonkey.com/api/v3/), and was pleased to see the familiar **Run in Postman** button. I imported the collection of all of their endpoints into the Postman app, and could immediately see how their endpoints were organized and how every request would work. So easy! ![](https://assets.postman.com/postman-docs/surveymonkey_docs.png) The second request in my Postman Collection would be to `POST` every question to my existing survey. For the authorization, [create a new SurveyMonkey app](https://developer.surveymonkey.com/apps/). Under their **Settings** tab, select the scopes and permissions that your app will have. ![](https://assets.postman.com/postman-docs/surveymonkey_permissions.png) On this same page, copy the access token and add this information as an [environment variable](https://learning.postman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/) called `surveymonkey_token` under the environments editor. In this same manner, you will also need to update the `SURVEY_ID` and `PAGE_ID` environment variables, which you can now `GET` using the [other SurveyMonkey API endpoints](https://developer.surveymonkey.com/api/v3/#surveys).  ![](https://assets.postman.com/postman-docs/surveymonkey_env_editor.png) Under the **Pre-request Script** tab, let’s access the airtable records and format the question data in the way that the SurveyMonkey API requires, to be sent in the request body. ![](https://assets.postman.com/postman-docs/surveymonkey_script.png)### **Scripting in Postman**

 A lot of people know [Postman Collections](https://learning.postman.com/docs/postman/collections/intro_to_collections/) as a way to document and share their APIs, like how SurveyMonkey shared their collection with me using the **Run in Postman** button, so that I could get started faster. The collection I was building in the Postman app was a different kind of collection. This operational collection works like a script or utility, and will continue to iterate over every airtable record and create a new question until there are no more questions left. - **Controlling your workflow:** we can use [`postman.setNextRequest()`](https://learning.postman.com/docs/postman/scripts/branching-and-looping/) to continue sending the same request until no more questions remain.
- **Saving state:** we can use an [environment variable](https://learning.postman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/) like `airtable\_records` to save the current state of the array containing all the questions that remain to be uploaded.
 
---

### **Try it yourself**

  Click the orange **Run in Postman** button to check out the **Airtable to SurveyMonkey Uploader** collection. **Need help getting started?** Check out the [Airtable to SurveyMonkey uploader collection documentation](https://www.postman.com/postman/published-postman-templates/collection/t17ru0x/airtable-to-surveymonkey-uploader) for step-by-step instructions and helpful screenshots. ![](https://assets.postman.com/postman-docs/surveymonkey_published_docs.png)