> For the complete documentation index, see [llms.txt](https://liams-organization-5.gitbook.io/scottishglen/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liams-organization-5.gitbook.io/scottishglen/api-routes/asset-link.md).

# Asset Link

This is the API Documentation for the /api/asset-link/ route.

## Retrieve ALL Asset Links&#x20;

<mark style="color:blue;">`GET`</mark> `/api/asset-link/`

Use this method to get ALL Asset Links from the Database.

{% tabs %}
{% tab title="200: OK AssetLink\[]" %}
Response will be an array of [Asset Link](/scottishglen/types/asset-link.md) objects.
{% endtab %}
{% endtabs %}

## Get ALL links by Hardware ID

<mark style="color:blue;">`GET`</mark> `/api/asset-link/hardware/:id/get-all`

#### Path Parameters

| Name                                 | Type   | Description         |
| ------------------------------------ | ------ | ------------------- |
| id<mark style="color:red;">\*</mark> | String | The ID of the Asset |

{% tabs %}
{% tab title="200: OK { hardware: HardwareAsset, link: AssetLink }" %}
Response consists of both the Hardware Asset and the [Asset Link](/scottishglen/types/asset-link.md).
{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Get ALL links by Software ID

<mark style="color:blue;">`GET`</mark> `/api/asset-link/software/:id/get-all`

Response consists of both an array with the Software Asset and the [Asset Link](/scottishglen/types/asset-link.md).

#### Path Parameters

| Name                                 | Type   | Description         |
| ------------------------------------ | ------ | ------------------- |
| id<mark style="color:red;">\*</mark> | String | The ID of the Asset |

{% tabs %}
{% tab title="200: OK { software: SoftwareAsset, link: AssetLink }" %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Get ALL links by Software ID (excl. Software Asset)

<mark style="color:blue;">`GET`</mark> `/api/asset-link/software/:id`

Response consists of both only the [Asset Link](/scottishglen/types/asset-link.md) array.

#### Path Parameters

| Name                                 | Type   | Description         |
| ------------------------------------ | ------ | ------------------- |
| id<mark style="color:red;">\*</mark> | String | The ID of the Asset |

{% tabs %}
{% tab title="200: OK AssetLink\[]" %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}

## Insert Asset Link

<mark style="color:green;">`POST`</mark> `/api/asset-link/`

You can use this method to insert an Asset Link into the Database.

#### Request Body

| Name                                           | Type   | Description                                                       |
| ---------------------------------------------- | ------ | ----------------------------------------------------------------- |
| hardware\_id<mark style="color:red;">\*</mark> | String | ID of the Hardware Asset you would like to be a part of the link. |
| software\_id<mark style="color:red;">\*</mark> | String | ID of the Software Asset you would like to be a part of the link. |
| date<mark style="color:red;">\*</mark>         | String | The Date the link was created                                     |
| created\_by<mark style="color:red;">\*</mark>  | String | The E-Mail Address of the Employee who creates the link.          |

{% tabs %}
{% tab title="400: Bad Request Body is not accurate to the specification above." %}

{% endtab %}

{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}

## Delete Asset Link

<mark style="color:red;">`DELETE`</mark> `/api/asset-link/hardware/:hwid/:swid`

#### Path Parameters

| Name                                   | Type   | Description                   |
| -------------------------------------- | ------ | ----------------------------- |
| hwid<mark style="color:red;">\*</mark> | String | The ID of the Hardware Asset. |
| swid<mark style="color:red;">\*</mark> | String | The ID of the Software Asset. |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}
