Importing Flask APIs to Insomnia: A Step-by-Step Guide Using the API URL

This is just a quick guide to import , so it is safe to assume that:

  1. You know how to run your flask app server.

  2. You know how to access your api on localhost:port

  3. You know what Insomnia is and its usefulness in API development and testing

First step after opening your server address in my case "http://127.0.0.1:5000/".

You will see the API version at the top of the page and a highlighted ".json" link just below it. See below image for clarity

You are to right click on the link (/swagger.json in this case) and copy the link address.

The link address we copied will be used for the import on Insomnia.

Now we head over to Insomnia and create a new project Folder. See below image for reference.

We will click on import From and Select URL from the dropdown menu.

This will open up an input box requesting for the url to import. So we paste the url we copied earlier from the webpage serving our flask api and click on fetch and import.

It will then ask you to "What you would like to import your API as" with two choices, I selected Request Collection in my case

Then you will get a success message that the Import was successful with all your API endpoints imported at once.

The next step will be to setup your environment variable with your base_url as shown in the image below, then delete the sub environments and close

All your endpoints will be imported and working perfectly. Moreso you can now send all your http requests without errors or manually writing the schema in the json body.

The End. You can leave comments or questions for clarity.

4
Subscribe to my newsletter

Read articles from Ojonuba Jeremiah directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ojonuba Jeremiah
Ojonuba Jeremiah

I am a software developer (majorly Python) from Nigeria. I love tutoring, troubleshooting and playing around with code. I am giving Technical writing a go.