📄️ 1. Create a New Project
The first step is to create a new project. A new project should be created automatically when you open API Parrot. If you have another project open, you can create a new one by clicking on the clicking File > New Project in the top menu or pressing Ctrl + N.
📄️ 2. Adding a Collection
Once we have created the project, the next step is to create a collection. A collection is a container that can hold multiple HTTP requests and responses.
📄️ 3. Capturing Exchanges
Now that we have created a collection, we can start capturing exchanges. Exchanges are HTTP request-response pairs, where the request is sent to a server and the response is received. Storing the response aswell as the request allows API Parrot to identify patterns in the data
📄️ 4. Cleaning Up
Now that the exchanges are captured, we can clean up the collection by removing any unnecessary exchanges or variables. This is a good practice for multiple reasons:
📄️ 5. Adding Functions
The idea behind functions in API Parrot is to be able to break out specific parts of a collection to serve different purposes. This can be useful if you have a large collection with requests that does multiple things, and you want to separate these things into smaller parts and make it more modular. Functions also differ from collections in that they can have user-defined inputs and outputs.
📄️ 6. Adding Inputs and Outputs
In this section, we will add the arguments (inputs and outputs) to the function we created in the previous section. In our case we want the function Get City And State From Zip to take a ZIP code as input and return the city and state for that ZIP code. In our recorded flow, the ZIP code used was 10001 and the city and state returned was NEW YORK, NY.
📄️ 7. Export Code
Once the function is finished, we can export the function as javascript code to enable us to use it however we want.
📄️ 8. Bonus - Using Dependencies
In the previous step, we created a function to get the city and state for a given zip code.