How to Use the ProAbono API with Insomnia
Insomnia is a REST client for sending HTTP requests and reading the responses of REST APIs. Requests are saved, organised into workspaces and shared with others, and custom environments hold the variables a request needs — which is what makes it usable against an API that requires authentication. It is free and available for Windows, Mac and Linux.
Procedure
Section titled “Procedure”1. Install Insomnia
Section titled “1. Install Insomnia”Download the client for the operating system in use from the Insomnia download page.
2. Export the ProAbono collection from Postman
Section titled “2. Export the ProAbono collection from Postman”The ProAbono collection — the set of predefined requests covering the API — is published for Postman only, so it reaches Insomnia through one export:
- Import the collection into Postman, with the button on How to Use the ProAbono API with Postman.
- In Postman, open the collection’s menu and choose Export.
- Keep the Collection v2.1 format and save the JSON file.
3. Import the collection into Insomnia
Section titled “3. Import the collection into Insomnia”In Insomnia, choose Import from the workspace menu, then From File, and select the JSON file exported above. The Postman v2.1 format is read natively, and each ProAbono resource becomes a folder of requests.
4. Set up an environment
Section titled “4. Set up an environment”Authentication is Basic Access: the Agent key is the username and the API key the password, both read from the BackOffice (How to Get My API Keys). Open Manage Environments and create an environment carrying the base URL and the two credentials — as environment variable names, never as the keys themselves:
{ "base_url": "https://api-42.proabono.com/v1/", "agent_id": "$PROABONO_AGENT_ID", "agent_key": "$PROABONO_AGENT_KEY"}5. Send a first request
Section titled “5. Send a first request”Open one of the imported requests — a customer lookup is the shortest — set ReferenceCustomer to cust-42 and send it. A 200 response carrying the customer confirms the environment; a 401 means the two keys are the wrong way round. Every resource the collection covers is described in the API reference.
Can you import collections into Insomnia?
Section titled “Can you import collections into Insomnia?”Yes, and not only from a file. A collection is also imported from a URL — Import > From URL — or from the command line with the “insomnia import” command. JSON and YAML are both accepted, whether the collection was exported from Insomnia or from another REST client. Refer to the Insomnia documentation for more information on using the command line.
What are the differences between Postman and Insomnia?
Section titled “What are the differences between Postman and Insomnia?”Postman and Insomnia are both popular tools for testing and debugging REST APIs. Here are some key differences between the two:
- Supported platforms: Postman is available for Windows, Mac, Linux, and as a browser extension, while Insomnia is available for Windows, Mac, and Linux.
- Protocol support: Postman supports a wide range of protocols, including HTTP, HTTPS, REST, GraphQL, and SOAP, while Insomnia primarily focuses on HTTP and REST requests.
- Environment management: Postman offers advanced environment management functionality that allows you to define environment variables and use them in requests, while Insomnia also provides environment management but with fewer advanced features.
- Collaboration: Postman offers real-time collaboration feature that allows users to work on the same collections simultaneously, whereas Insomnia does not have this feature.
- Pricing: Postman is free for personal use but offers paid plans for businesses. Insomnia is free at all levels.
It is important to note that these differences are just some of the many differences between Postman and Insomnia. It is recommended to try both and choose the one that best fits your needs.