# Get Started

Here are a few simple steps to demonstrate some capabilities of Impossible Cloud's Management Console API. Let's go through them step-by-step.

## Authorize and get list of contracts

1. [Prepare ](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/authentication-mechanisms)authentication by creating an API key.
2. [Open the Swagger web interface and add your API key](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/swagger-web-interface).
3. Expand **GET /contract/list** and click **Try it out** and then **Execute** to receive the list of the available contracts. [List of key terms](https://docs.impossiblecloud.com/partner-portal-help/glossary/list-of-key-terms).

If you have contracts associated with your Impossible Cloud Management Console (ICMC) account, you should receive a response body containing all your contracts, for example:

```
[
  {
    "id": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
    "distributorId": "7e1fe78d-3f61-4215-8c48-eda9e1b08f13",
    "reservedCapacity": 100000000000000,
    "allocatedCapacity": 53000000000000,
    "costStorageGBCents": "100",
    "costEgressGBCents": "0",
    "currency": "EUR",
    "details": "Impossible Cloud Test Contract"
  },
  {
    "id": "bb0a102d-ad4b-4738-b405-561add97abbb",
    "distributorId": "7e1fe78d-3f61-4215-8c48-eda9e1b08f13",
    "reservedCapacity": 10000000000000,
    "allocatedCapacity": 0,
    "costStorageGBCents": "100",
    "costEgressGBCents": "0",
    "currency": "EUR",
    "details": "Another test contract"
  }
]
```

Where:

* **id** or the contract id, is the unique identifier of the particular contract;
* **distributorId** is the unique identifier of your distributor account;
* **reservedCapacity** is the total storage capacity in bytes associated with this particular contract id;
* **allocatedCapacity** is the storage in bytes already allocated to your  partners;
* **costStorageGBCents** is the excess usage fee per GB/month. This price only applies if you go above your reserved capacity or allocated storage;
* **costEgressGBCents** is the excess egress fee per GB/month as per your agreement with Impossible Cloud;
* **currency** is your actual currency used for the billing purposes;
* **details** is the name of the contract.

All of these details are also available in the [Management Console ](https://partner.impossiblecloud.com/)user interface except for **id** and **distributorId.**

## Get list of partners from a particular contract

1. Expand **GET /contract/{contractID}/partners** [ in the Swagger web interface](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/swagger-web-interface) and click the **Try it out** butto&#x6E;**.**
2. Copy a contract id (**id**) of the contract you'd like to view (which you will have received in the previous step) and paste it into the **contractID** field.
3. Click "**Execute**".

If you have some partners under that contract, you should receive a response body containing those partners, for example:

```
[
  {
    "id": "e37e6c0f-688e-4da4-8717-a52b48bcee3d",
    "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
    "name": "Test partner",
    "allocatedCapacity": 5000000000000
  },
  {
    "id": "e4985686-c089-46fd-ae82-0af7ce2888bf",
    "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
    "name": "Another test partner",
    "allocatedCapacity": 0
  }
]
```

Where:

* **id** is the unique identifier of the particular partner;
* **distributorContractId** is the unique identifier of your distributor account;
* **name** is the name of the partner;
* **allocatedCapacity** is the storage in bytes already allocated to that partner.

## Creating a new partner

Let's create a new partner and see what we can do and what the responses might look like.

1. Expand **POST /partner** [ in the Swagger web interface](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/swagger-web-interface) and click the **Try it out** butto&#x6E;**.**
2. Edit the **partnerDetails** field:

* Change the **allocatedCapacity** to the number of bytes you'd like to allocate to the new partner
* Copy your **distributorContractId** from the previous request and paste it between quotes in the appropriate part of the request body as the value of the **distributorContractId** key;
* Enter the new partner name as the value of the **name** key.

Let's say we'd like to create a new partner named "New partner company" with the allocated capacity of 5 TB. Eventually, the **partnerDetails** field should look like this:&#x20;

```
{
  "allocatedCapacity": 5000000000000,
  "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
  "name": "New partner company"
}
```

{% hint style="success" %}
You can set **allocatedCapacity** value to "0" if you'd like that partner to use the "[Pay-per-use](https://docs.impossiblecloud.com/partner-portal-help/glossary/list-of-key-terms)" model.
{% endhint %}

3. Click "**Execute**".

If the body is correct and there is enough capacity to be allocated, you should receive a response body containing information about the newly created partner:

```
{
  "id": "4b14e456-ef23-46ed-9070-f5eaf1b5ef04",
  "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
  "name": "New partner company",
  "allocatedCapacity": 5000000000000
}
```

Where:

* **id** is the unique identifier of the new partner;
* **distributorContractId** is the unique identifier of your distributor account;
* **name** is the name of the new partner;
* **allocatedCapacity** is the storage allocated to that partner just now.

## Changing partner's name

Let's rename our newly created partner.

1. Expand **PUT /partner/{partnerID}** [ in the Swagger web interface](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/swagger-web-interface) and click the **Try it out** butto&#x6E;**.**
2. Edit the **partnerID** field:

* Copy the partner's **id** from the previous request and paste it to the "partnerID field.

3. Edit the **partnerDetails** field:

Let's say we'd like to rename the partner to "Renamed partner". Eventually, the **partnerDetails** field should look like this:&#x20;

```
{
  "name": "Renamed partner"
}
```

3. Click "**Execute**".

If the body is correct and the new name is correct, you should receive a response body like this:

```
{
  "id": "4b14e456-ef23-46ed-9070-f5eaf1b5ef04",
  "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
  "name": "Renamed partner",
  "allocatedCapacity": 5000000000000
}
```

## Updating partner's allocated capacity

Let's update our newly created and renamed partner allocated storage capacity.

1. Expand **PUT /partner/{partnerID}** [ in the Swagger web interface](https://docs.impossiblecloud.com/partner-portal-help/management-console-api/management-console-api/swagger-web-interface) and click the  **Try it out** butto&#x6E;**.**
2. Edit the **partnerID** field:

* Copy the partner's **id** from the previous request and paste it to the "partnerID field.

3. Edit the **partnerDetails** field:

Let's say we'd like to change the partner's allocated storage capacity to 250 MB. Eventually, the **partnerDetails** field should look like this:&#x20;

```
{
  "allocatedCapacity": 250000000
}
```

3. Click "**Execute**".

If the body is correct and the new name is correct, you should receive a response body like this:

```
{
  "id": "4b14e456-ef23-46ed-9070-f5eaf1b5ef04",
  "distributorContractId": "606f031c-0f85-4444-8c7d-4a8f1ede7cd3",
  "name": "Renamed partner",
  "allocatedCapacity": 250000000
}
```

{% hint style="info" %}
You can update partner's name and change the partner's allocated capacity within a single request. In this case, the partnerDetails body will look like this:\
\
\&#xNAN;**{** \
&#x20;  **"allocatedCapacity": 250000000,**

&#x20;  **"name": "Renamed partner"**\
**}**
{% endhint %}
