# Insomnia Application Tutorial
source: https://developer.mastercard.com/easy-savings-specials/documentation/insomnia-tutorial/index.md

## How to install and configure the Insomnia application {#how-to-install-and-configure-the-insomnia-application}

### Overview {#overview}

Insomnia is a free and open-source REST client application available for Linux, Mac, and Windows operating systems. This tutorial shows you how to use Insomnia with the Mastercard authentication plugin to make an API call.

#### You learn how to: {#you-learn-how-to}

* Install the Insomnia application.
* Install the Mastercard plugins (if required).
* Configure environment variables and Easy Savings Specials Merchant Offers keys.
* Invoke an Easy Savings Specials Merchant Offers from Insomnia.

Tip: Read about how we developed the Mastercard plugin for Insomnia in our [blog post](https://developer.mastercard.com/blog/a-mastercard-plugin-for-insomnia-rest-client/).

#### Install Insomnia application {#install-insomnia-application}

Note: Mastercard supports Insomnia application version 2020.5.1.

1. Download the [Insomnia](https://insomnia.rest/download/) application for your operating system.
2. Install and launch the application, and you should see the following user interface. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins1.png)
3. Download the Mastercard Insomnia plugin from [here](https://github.com/Mastercard/insomnia-plugin-mastercard). Follow the steps in the **README.md** file to load it as a plugin in Insomnia application. Note: If you encounter issues with the latest Mastercard Insomnia plugin, try using the [version 1.1.14](https://github.com/Mastercard/insomnia-plugin-mastercard/releases/tag/v1.1.14).

#### Import the Easy Savings Specials Merchant Offers workspace template {#import-the-easy-savings-specials-merchant-offers-workspace-template}

An Insomnia workspace template with a default environment is available for import into your Insomnia application.

1. From the **Workspace** dropdown menu (top left with down arrow), select **Import/Export** . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins2.png)
2. Select **Import Data** → **From File** → [Mastercard_easy_savings_Specials_Merchant_offers.json](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/Mastercard_easy_savings_Specials_Merchant_offers.json) (6KB). ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins4.png) The template workspace has been imported.  
3. Select the **Easy Savings Specials Merchant Offers Workspace** . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins3.png)
4. Open the **Environments** dropdown menu. You see two environments, **sandbox** and **production** . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins6.png)

### Using the Easy Savings Specials Merchant Offers API {#using-the-easy-savings-specials-merchant-offers-api}

**Switch workspace**

1. In the **Workspace** dropdown menu, select **Easy Savings Specials Merchant Offers API** . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tg_01.png) We are now in the Easy Savings Specials Merchant Offers workspace.  
2. Open the **Environments** dropdown menu. You see **sandbox** and **production** environments. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tg_02.png)

**Manage environments.**

1. In the **Environments** dropdown menu, select **Manage Environments** . You see the environment variables with placeholder values. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tg_03.png)
2. Replace the placeholder values with the real values, including your API key.

Note: There is an environment variable called **host** that stores the base URL of the Easy Savings Specials Merchant Offers API endpoints. Using this environment variable, you can write your request URL as *{{host}}/* instead of our base URL. Depending on the selected environment, the request is sent to the corresponding host.

#### Fill in API keys {#fill-in-api-keys}

1. Sign in to Mastercard Developers.
2. Create a Project with the Easy Savings Specials Merchant Offers. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins008.png)
3. Fill in the details of your **Consumer Key** , **Path to Keystore (.p12)** , **Key Alias** , and **Keystore Password** .  
   Refer to the following example for the sandbox environment. You can do the same for the production environment if you have an approved production key. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins009.png) ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tg_04.png)
4. Click **Done** to close the Manage Environments dialog box.  
   You are now ready to call the APIs authorized by the key you entered.

## How to Call Easy Savings Specials Merchant Offers API {#how-to-call-easy-savings-specials-merchant-offers-api}

To call Easy Savings Specials Merchant Offers API, you have two options.
1. **Export** your postman collection to a file. You can find existing Mastercard collections in the `<ESS postman collection required>`. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_01.png)
2. **Import** the collection into the workspace in Insomnia. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins12.png)
3. Select the endpoint, click **Send** to submit the request, and get the response. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/ins18.png)
1. Select **New Request** in the request dropdown menu. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_02.png)
2. Enter the request **Name** and select the **HTTP method** . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_03.png)
3. In the request URL field, insert the endpoint URL. As mentioned earlier, you can use the host environment variable as the base URL. Type *{{host}}* in the box, and Insomnia automatically prompts you with the available matching variable. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_04.png)
4. Complete the URL by adding the endpoint. In this example, it is *{{host}}/easysavings/specials/offers* . ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_06a.png)
5. Click **Send** to submit the request and get the response. ![](https://static.developer.mastercard.com/content/easy-savings-specials/uploads/tge_07a.png)

The setup of the Insomnia application is complete, and you can now call the Easy Savings Specials Merchant Offers API.
Note: If you need assistance, get in touch with the [Mastercard support team](https://developer.mastercard.com/support).
