# API Description (placeholder)

For automatic execution of operations, Mobsted uses API requests (calls) to either itself or third-party services. In order to make operations work we have to set it up. The set up consists out of the following steps:

1. Create API Provider \[ Step by step example → ]
   1. Create API Provider Method \[ Step by step example → ]
   2. Create API Key \[ Step by step example → ]
2. Create Operation Based on API Provider created \[ Step by step example → ]

## Creating API Provider <a href="#creating_api_provider" id="creating_api_provider"></a>

1. Go to **Providers** section on the Side Menu of Mobsted platform\
   ![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/other/1567974658980/image.png)
2. Click **Add API Provider**
3. Fill in the fields:
   1. **Base URL** (Mandatory field) - enter the base URL of the service you would make API calls on.
   2. **Description** - enter the description of the API Provider: tasks that would be executed by the service.
   3. **Authentication Documentation** - enter information about the authorization methods of the API requests sent to a third-party service
   4. **Active** - activation button for your API Provider.
4. Click **Save API Provider**
5. Click **Close**

## Creating API Provider Method <a href="#creating_api_provider_method" id="creating_api_provider_method"></a>

Method is an action, which is performed when API Request is sent to the server. To create one do the following steps:

1. Navigate to **Providers** section on the Side Menu of Mobsted platform\
   ![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/other/1567974729015/image.png)
2. Select the **API provider**, for which you want to create API method
3. In the pop up opened go to the **API Provider Methods** tab
4. Click **Create new API Provider Method**
5. Fill in the following fields:
   1. **Api Provider Method Name**
   2. **Method** - select one of the available HTTP request methods (GET, POST, PUT, DELETE)
   3. **Endpoint URL**
   4. **Consumes Type** - select the data type used when sending the API request
   5. **Produces Type** - elect the response type to the request sent by the API
   6. **Parameters** - create the required and optional parameters for your API method

Most API queries must contain a number of parameters.

To create a parameter, click the **Add Parameter** button.

1. In the pop up opened fill in the following fields:
   1. **Name** - Parameter name according to the documentation of the third-party service provider
   2. **In** - select in which part of the API request this parameter should be used (query, header, path, formData, body)
   3. **Type** - select parameter data type (string, number, integer, boolean)
   4. **Description** - add the parameter description so that your colleagues can understand what data you need to specify
   5. **Required** - check the checkbox if you want the parameter to be mandatory
2. Click **Save Parameter**. If the API method should contain several parameters, then repeat the above steps.

![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/articles/eq6ixf63w9/1545134799477/screen-shot-2018-12-18-at-5-05-15-pm.png)

1. Click **Save API Provider Method**
2. Click **Close** to return to API Provider settings.

## Creating API Key <a href="#creating_api_key" id="creating_api_key"></a>

Most of the API Methods would not work without API Keys set up. API Keys are used to store and use authorization data. To create one perform the following steps:

1. Go to the **Providers** section on the Side Menu of Mobsted platform\
   ![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/other/1567974741514/image.png)
2. Select API provider, which would store API Keys
3. In the window opened navigate to **API keys** tab
4. Click **Create new API Key**
5. Fill in the following fields:
   1. **Api Key Name** - enter the name of the API Key;
   2. **Method** - select on of the authentication methods available (Basic, Digest, SAML, WS-Federation, OAuth, OpenID Connect)
   3. **Key1** - primary key
   4. **Key2** - secondary key
   5. **Key3** - 3d key
   6. **AuthUrl** - URL address to send authentication data

![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/articles/0wy07wa4zw/1541582663168/ezgif-com-video-to-gif-7.gif)

1. Click **Save API Key**
2. Click **Close**

## Creating Operation <a href="#creating_operation" id="creating_operation"></a>

Operation is the API call to the third-party service (sometimes to the platform itself) to perform some action.

In the API Provider section we specify the parameters of the call, and in the Operations section we specify the instances on which the Operation is ran.

1. Go to the **Operations** section on the Side Menu of Mobsted platform

![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/other/1567975014328/image.png)

1. click **Add Operation**
2. From the panel on the left select API Provider Method as the template to create an Operation![](https://storage.googleapis.com/helpdocs-assets/jyme83anlw/other/1567975875009/image.png)
3. Fill in the following fields:
   1. **Operation Name**
   2. **Data transformation** - change data on the go. Use hashtag reference for that
   3. **Conditional Data Transformation** - change data on the go conditionally. Use hashtag reference for that
   4. **Execution**
      1. Select **API Key** if applicable
      2. Select an **Application**
4. Click **Save Operation**
5. Click **Close**
