# Test API in Sandbox using Insomnia
source: https://developer.mastercard.com/doconomy-aland-index/documentation/tutorials-and-guides/accessing-sandbox-tutorial/index.md

Insomnia is a popular open-source REST client application that works on Windows, Mac, and Linux. It is a handy tool for developers to test API calls by filling in the parameters without writing any code.

The Doconomy Aland Index API can be tested with this tool. This tutorial will help you set up the Insomnia tool and test the API in the Sandbox environment. You can follow similar steps to test the API in the Production environment once your access is approved.
>
> #### What you will learn. {#what-you-will-learn}
>
> * How to configure the API for testing via the Insomnia tool.
> * How to set up the Sandbox environment in the Insomnia tool.
> * How to test the API.
>
> #### Estimated time to complete this tutorial. {#estimated-time-to-complete-this-tutorial}
>
> * 10-15 minutes

## Pre-requisites {#pre-requisites}

1. [Insomnia tool](https://insomnia.rest/) installed.
2. Project created with the Doconomy Aland Index API. Refer [here](https://developer.mastercard.com/doconomy-aland-index/documentation/getting-started/index.md#before-you-start) for more details.

## Install Mastercard Plugin {#install-mastercard-plugin}

You should complete all pre-requisites before proceeding further.

1. Open the **Insomnia → Preferences** menu and select the **Plugins** tab.
2. In the **npm-package-name** edit box, enter `insomnia-plugin-mastercard-auth` and click the **Install Plugin** button.
3. If you see the name and version appear in the table, the plugin is installed successfully. If there is an error, proceed to the Manual Installation section. ![Install Mastercard Plugin](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_0.png)

### Manual Installation {#manual-installation}

Certain corporate networks may cause an error when attempting to install the plugin directly from the web. Perform a manual installation instead:

1. Download the `insomnia-plugin-mastercard-auth.zip` file from the plugin's [Latest Release](https://github.com/Mastercard/insomnia-plugin-mastercard-auth/releases).
2. On the **Insomnia → Preferences → Plugins** tab, click the **Show Plugin Folder** button.
3. Under the **Plugins** folder, create a new folder named **insomnia-plugin-mastercard-auth**.
4. Extract the contents of the zip file from step 1 into the **insomnia-plugin-mastercard-auth** folder created in step 3.
5. In the Plugins folder, you should see the following files: ![Install Mastercard Plugin](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_00.png)
6. Run Insomnia and check if the Mastercard plugin is shown in the Plugins tab.

## Set up Sandbox Environment {#set-up-sandbox-environment}

1. From the drop-down of the top-left purple bar, select the "Create Workspace" option to create a new workspace.

2. Name the workspace as "Doconomy Aland Index" and click **Create** .
   ![Create Workspace](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_1.png)

3. Add Sandbox as one of the environment.

4. From the "No Environment" drop-down list, go to the "Manage Environments".
   ![Manage Environment](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_2.png)

5. Click '+' and select "Environment" to create a new environment.
   ![Create Environment](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_4.png)

6. On the left-side under "Sub Environments", double-click the "New Environment" to name the new environment as "Sandbox".
   ![Rename Environment](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_5.png)

7. Copy and paste the following configuration under Sandbox and click **Done** to finish.

```json
{
    "host": "<HOST URL>",
    "mastercard": {
        "consumerKey": "<CONSUMER KEY>",
        "keyAlias": "<KEY ALIAS>",
        "keystoreP12Path": "<PATH to .p12 FILE>",
        "keystorePassword": "<KEYSTORE PASSWORD>"
    }
}
```

![Set up Complete](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_6.png) 8. The Insomnia tool is successfully set up. Follow the next section below.

## Configure Sandbox Environment {#configure-sandbox-environment}

Now, as your Insomnia tool has been set up, let's configure by adding a Sandbox environment.

1. Log in to your Mastercard developers account and go to your project. If you have not created your project yet, follow these [steps](https://developer.mastercard.com/doconomy-aland-index/documentation/getting-started/index.md).

2. Use the following details from the "Sandbox" section of your project:

   * Consumer Key
   * Key Alias
   * Keystore Password
3. Use the following details:

   * host as `https://sandbox.api.mastercard.com`
   * keystoreP12Path as the absolute location of the .p12 file which was generated during your project creation.
4. Go to **Manage Environments** of Insomnia tool and update the configurations as shown below and click **Done** to finish.
   ![Configuration Complete](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_7.png)

5. Insomnia tool is successfully configured and ready to test the API in Sandbox. Follow the next section below.

## Invoking Doconomy Aland Index API {#invoking-doconomy-aland-index-api}

This section provides step-by-step directions to call the `/transaction-footprints` API from the Insomnia tool.

1. To create a new request, click '+' besides the 'Filter' textbox and select the "New Request" option.
   ![New Request](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_8.png)

2. Name the request as "Transaction Footprints", select the request method as "POST", body type as "JSON" and click **Create** .
   ![Name Request](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_9.png)
   ![Request Method](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_10.png)
   ![Body Type](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_11.png)

3. Configure the request URL by copying the text **{{host}}/doconomy/transaction-footprints** in the request URL.
   ![Request URL](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_12.png)

4. Configure the request payload by pasting the JSON request as shown below.

```json
{
    "transactions": 
    [
        {
            "transactionId": "94562036-bdd2-4ed5-92ed-ab1abd4d329a",
            "mcc": "3000",
            "amount": {
                "value": 150,
                "currencyCode": "EUR"
            }
        }
    ]
}
```

![Request URL](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_13.png)

5. To send the request, click the **Send** button. You should see the successful response with **200 OK** . ![Successful Response](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_14.png)
6. You can also send multiple transactions in the request payload. ![Multiple Requests](https://static.developer.mastercard.com/content/doconomy-aland-index/Images/insomnia/insomnia_15.png)
7. You have successfully invoked the `/transaction-footprints` API from the Insomnia tool.
8. Following steps 1-5 of this section, you can invoke the other two APIs `/supported-currencies` and `/supported-merchant-categories.`

Congratulations, you have completed this tutorial.
