# Importing API Definition

This article explains how API definitions can be imported from local files or URLs into the Element Repository to automatically create Webservice elements and streamline API configuration.&#x20;

You can import API Definition into the Element Repository using following options:&#x20;

* [**Create Folder** **(+)** icon ](#importing-api-definition-using-create-folder--icon)
* [**Ellipsis (...)** icon](#importing-api-definition-using-ellipsis-...-icon)

## Importing API Definition using Create Folder (+) Icon

To Import API Definition in Element Repository using **Create Folder (+)** icon, perform the following actions:&#x20;

1. On the **Home** page, under **Projects**, select the required **Project**.&#x20;
2. Select **Design Studio**. In the **Element Repository** page, locate the **Create Folder (+)** icon. &#x20;
3. Select **Create Folder (+)** icon and select **Create new folder** to create a new folder for element repository. A new folder is created. &#x20;
4. In the **New Folder** text box, enter the element repository folder name. &#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FyFNQMzJkiasUrCCiMgh8%2Funknown.png?alt=media&#x26;token=a5ed30d3-5097-42ee-bace-0585ddc95523" alt=""><figcaption></figcaption></figure>

5. Select the newly created element repository folder and select **Create Folder (+)** icon.&#x20;
6. From the menu options, select **Import API Definition**. The **Import API Definition** dialog box appears.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FeOb7Q4ikrx2JmOwe5tWs%2Funknown.png?alt=media&#x26;token=09fa2476-f56b-4841-a5a2-ac419372ab8c" alt=""><figcaption></figcaption></figure>

7. You can import API definition using the following options:&#x20;
   * **File**&#x20;
   * **URL**&#x20;

<details>

<summary><strong>File</strong></summary>

To import an API definition using **File** option, perform the following actions:  &#x20;

1. In the **Import API Definition** dialog box, select the **Upload JSON File** button.&#x20;
2. Select the appropriate **JSON File** from your local system.&#x20;
3. Select the **Import API** to import the selected JSON File.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FTKrOWia5kCyzG9al5r2b%2Funknown.png?alt=media&#x26;token=b00bb024-a5e6-4bed-8c51-cc88670f429e" alt=""><figcaption></figcaption></figure>

4. After the API definition is imported, it appears in the **Element Repository** page.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FzgYiE52ErgEa8sMOS7RA%2Funknown.png?alt=media&#x26;token=be99be89-62d7-4f10-aadb-9ccfbc5a9cc8" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary><strong>URL</strong></summary>

To import an API definition using **URL** option, perform the following actions:  &#x20;

1. In the **Source label** text box, enter the API endpoint URL.&#x20;
2. From the **Protocol** dropdown, select the required protocol.

{% hint style="info" %}
**Note**: &#x20;

* When using SOAP service, make sure to enter **?WSDL** at the end of URL entered in **Source label** text box which automatically selects prototype as WSDL. \
  For example:  <https://ecs.syr.edu/faculty/fawcett/code/calcWebService/Calc.asmx?WSDL>
* When using Rest service, **Swagger** protocol must be selected.&#x20;
  {% endhint %}

3. Select **Import API** button to import API Definition.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2Fob1o7b7eAgQnskezMg8B%2Funknown.png?alt=media&#x26;token=fe4af6f7-57f3-4944-a1d3-c0346915b83e" alt=""><figcaption></figcaption></figure>

4. After the API definition is imported, it appears in the **Element Repository** page.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FjPhYWuBRYnXMh6GuaKWO%2Funknown.png?alt=media&#x26;token=8ffd51ee-eafd-4d8c-9b0d-fe3c095db2ed" alt=""><figcaption></figcaption></figure>

</details>

8. Select the **send** button to execute the imported API definition.

{% hint style="info" %}
After executing the API request, you can go to **Response** tab to view the result. To learn more, [click here](https://docs.avoautomation.com/avo-assure-supported-technologies-for-automation/webservice-automation/viewing-response-details).&#x20;
{% endhint %}

9. Select the **save** button to store the configuration as a Webservice element.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FlsWvZ6b2FB80t4RYbRjU%2Fimage.png?alt=media&#x26;token=30b87466-9808-43bb-a0f4-03b0a456da1c" alt=""><figcaption></figcaption></figure>

## Importing API Definition using Ellipsis (...) Icon

To Import API Definition in Element Repository by selecting **ellipsis (...)** icon, perform the following actions:&#x20;

1. In **Element Repository** page, select the parent folder in which you want to import the API definition.&#x20;
2. Select the **ellipsis (...)** icon corresponding to that folder.&#x20;
3. From the menu options, select **Import Definition**. The **Import API Definition** dialog box appears.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FX988MWnOvMOfWTuOTq8d%2Funknown.png?alt=media&#x26;token=0848aec6-e2c2-4f4f-85d5-1863e6e1697b" alt=""><figcaption></figcaption></figure>

4. You can import API definition using the following options:&#x20;
   * **File**&#x20;
   * **URL** &#x20;

<details>

<summary><strong>File</strong></summary>

To import an API definition using **File** option, perform the following actions:  &#x20;

1. In the **Import API Definition** dialog box, select the **Upload JSON File** button.&#x20;
2. Select the appropriate **JSON File** from your local system.&#x20;
3. Select the **Import API** to import the selected JSON File.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FTKrOWia5kCyzG9al5r2b%2Funknown.png?alt=media&#x26;token=b00bb024-a5e6-4bed-8c51-cc88670f429e" alt=""><figcaption></figcaption></figure>

4. After the API definition is imported, it appears in the **Element Repository** page.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FzgYiE52ErgEa8sMOS7RA%2Funknown.png?alt=media&#x26;token=be99be89-62d7-4f10-aadb-9ccfbc5a9cc8" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary><strong>URL</strong></summary>

To import an API definition using **URL** option, perform the following actions:  &#x20;

1. In the **Source label** text box, enter the API endpoint URL.&#x20;
2. From the **Protocol** dropdown, select the required protocol.
3. Select **Import API** button to import API Definition.&#x20;

{% hint style="info" %}
**Note**: &#x20;

* When using SOAP service, make sure to enter **?WSDL** at the end of URL entered in **Source label** text box which automatically selects prototype as WSDL. \
  For example:  <https://ecs.syr.edu/faculty/fawcett/code/calcWebService/Calc.asmx?WSDL>
* When using Rest service, **Swagger** protocol must be selected.&#x20;
  {% endhint %}

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2Fob1o7b7eAgQnskezMg8B%2Funknown.png?alt=media&#x26;token=fe4af6f7-57f3-4944-a1d3-c0346915b83e" alt=""><figcaption></figcaption></figure>

4. After the API definition is imported, it appears in the **Element Repository** page.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FjPhYWuBRYnXMh6GuaKWO%2Funknown.png?alt=media&#x26;token=8ffd51ee-eafd-4d8c-9b0d-fe3c095db2ed" alt=""><figcaption></figcaption></figure>

</details>

5. Select the **send** button to execute the imported API definition.

{% hint style="info" %}
After executing the API request, you can go to **Response** tab to view the result. To learn more, [click here](https://docs.avoautomation.com/avo-assure-supported-technologies-for-automation/webservice-automation/viewing-response-details).&#x20;
{% endhint %}

6. Select the **save** button to store the configuration as a Webservice element.&#x20;

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FlsWvZ6b2FB80t4RYbRjU%2Fimage.png?alt=media&#x26;token=30b87466-9808-43bb-a0f4-03b0a456da1c" alt=""><figcaption></figcaption></figure>
