---
title: API
slug: vodafone-hands-on-lab/api
docTags: 
createdAt: 2023-11-28T10:01:57.226Z
---

It's possible to test the API by using a tool like [Insomnia](https://insomnia.rest/), which is an open source application (MIT Licence).&#x20;

## Installation

To install Insomnia

1. Go to [https://insomnia.rest/download](https://insomnia.rest/download)
2. Click on the icon of the operating system you use.
3. Click on the link to download the correct version.
4. Install the app.

## Collection & Environment

There are 2 concepts: **Environment** and **Collection**. We need both for our API based exercises.&#x20;

- The Environment contains all of your environmental variables which are more or less consistent. In the Environment, you’ll find things like the IMSOrg of our Platform environment, alongside security credentials like your private key and others. The environment file contains the credentials required to access the REST ressources, as a result of setting up an integration in the Adobe Developer Console.&#x20;
- The Collection contains a number of API requests that you can use.&#x20;

## Setup

Follow these steps:

- Open Insomnia
- Create a New Project and name it **AEP Hands-on Lab**
- Create a New Collection and name it **Set of AEP requests**
- Click on the little icon next to the **Base Environment&#x20;**&#x6D;enu
- Copy/paste the environment variables&#x20;

```json
{
"access_token": "eyJhbGciOiJSUzI1NiIsIng1dSI6Imltc19uYTEta2V5LWF0LTEuY2VyIiwia2lkIjoiaW1zX25hMS1rZXktYXQtMSIsIml0dCI6ImF0In0.eyJpZCI6IjE3MzMzMDAxMzU0ODJfZDYxZjA1NWUtZTczMC00ODYwLWExOWYtZjVhYjM0MGM4MTU2X3VlMSIsIm9yZyI6IjhBQjUxOTM1NjU5QzEwRTQwQTQ5NUZBMkBBZG9iZU9yZyIsInR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJjbGllbnRfaWQiOiJhYmFiYTU2ODgyNWM0NTAxYTU2OGNjNGMzMTZhMWZlZSIsInVzZXJfaWQiOiJGQkRCMUU4NDY2RDk3QjdEMEE0OTVFMTBAdGVjaGFjY3QuYWRvYmUuY29tIiwiYXMiOiJpbXMtbmExIiwiYWFfaWQiOiJGQkRCMUU4NDY2RDk3QjdEMEE0OTVFMTBAdGVjaGFjY3QuYWRvYmUuY29tIiwiY3RwIjozLCJtb2kiOiJmYTE0ZjE0ZSIsImV4cGlyZXNfaW4iOiI4NjQwMDAwMCIsInNjb3BlIjoib3BlbmlkLHNlc3Npb24sQWRvYmVJRCxyZWFkX29yZ2FuaXphdGlvbnMsYWRkaXRpb25hbF9pbmZvLnByb2plY3RlZFByb2R1Y3RDb250ZXh0IiwiY3JlYXRlZF9hdCI6IjE3MzMzMDAxMzU0ODIifQ.V4tPlkS9WRK2q2jbYap9Slz2EJ-aDwqZruFojWY0ib3V8EbwMJuda-5f-C3j0Sb1ch-_rFRwWKVuJxjTTcs0_NYGBBuuioWhzAli6lnASJF7KSHzrPyVs_PqOUnj4HPyDXEiPgNNzGoZ9hy61pcplXDeWYhBXhCTa7USmKqjjyxXPVPOlGe8Bpd7taTQM6PVhPdtKEzJpEEmOzytBDdCEa60LrSmCDDMIgw38uKd4tZVnicRttItB_phw4tXYkBalpm68nZh1ffV_t_cNAYl7IgOJutL7hcRraj-7G87F86Dv9Nl8xg_WCLnCovh9fqgsMNjZnXUnhPfSuQjf--hlg",
"x-api-key": "ababa568825c4501a568cc4c316a1fee",
"x-gw-ims-org-id": "8AB51935659C10E40A495FA2@AdobeOrg",
"x-sandbox-name": "sandbox02"
}
```

- The AEP documentation provides cURL examples; for instance, the following request retrieves a customer’s email and name using an identity:

```curl
curl -X GET \
  'https://platform.adobe.io/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=janedoe@example.com&entityIdNS=email&fields=identities,person.name,workEmail' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}'

```

- Src: [https://experienceleague.adobe.com/en/docs/experience-platform/profile/api/entities](https://experienceleague.adobe.com/en/docs/experience-platform/profile/api/entities)
- On the right panel, click on the + icon, to add a request from Curl

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/RoGNswSdvzLObbT_sgLl6_image.png)



- Paste the Curl command to import the request



![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/sqO81uZOnnpKv9vGevskQ_image.png)

- Click on **Import&#x20;**&#x62;utton
- Go to the **Headers&#x20;**&#x74;ab and set the variables that come from the Base Environment JSON file

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/DpWkPWck1kUY_TG0qWF88_image.png)

- Click on **Send&#x20;**&#x62;utton to get this response:&#x20;

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/iCytNJimIhrSRcPgK9C2Q_image.png)



:::hint{type="success"}
We are now ready to make tests with AEP API.
:::

