# Specification Groups

# Specification Group Index Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/specifications` is installed.</p>

#### Structure

See [View Specification Group](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint) for the structure of the specification group payloads inside the `data` array.

#### Example Request

```
GET /api/specification-groups?per_page=2
```

#### Example Response

```json
{
    "current_page": 1,
    "data": [
        //...
    ],
    "first_page_url": "http://aero.test/api/specification-groups?page=1",
    "from": 1,
    "last_page": 3,
    "last_page_url": "http://aero.test/api/specification-groups?page=3",
    "next_page_url": "http://aero.test/api/specification-groups?page=2",
    "path": "http://aero.test/api/specification-groups",
    "per_page": 2,
    "prev_page_url": null,
    "to": 2,
    "total": 5
}
```

<p class="callout info">See [View Specification Group](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint) for the structure of the specification group payloads inside the `data` array.</p>

# View Specification Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/specifications` is installed.</p>

#### Structure

##### Specification Group

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%; height: 737.907px;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td><td style="height: 29.7969px;">**Version**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the specification group</td><td>`>=0.1.0`</td></tr><tr><td>`name`</td><td>string</td><td>The name for the specification group</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the specification group</td><td>`>=1.0.0`</td></tr><tr><td>`fields`</td><td>array</td><td>An array of [Field](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint#bkmrk-field) objects</td><td>`>=0.1.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint#bkmrk-media) objects</td><td>`>=0.3.2`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Field

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%; height: 737.907px;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td><td style="height: 29.7969px;">**Version**  
</td></tr><tr><td>`name`</td><td>string</td><td>The name of the field</td><td>`>=0.1.0`</td></tr><tr><td>`presets`</td><td>array</td><td>An array of strings to use as preset options</td><td>`>=0.1.0`</td></tr><tr><td>`default`</td><td>string</td><td>The default value for the field, note: `_p:0` means the first preset</td><td>`>=0.1.0`</td></tr><tr><td>`prefix`</td><td>string</td><td>The prefix for the field</td><td>`>=0.1.0`</td></tr><tr><td>`suffix`</td><td>string</td><td>The suffix for the field</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the field</td><td>`>=1.0.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint#bkmrk-media) objects</td><td>`>=1.0.0`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/view-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Media

<table border="1" id="bkmrk-name-type-descriptio-2" style="border-collapse: collapse; width: 100%; height: 737.907px;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the media</td></tr><tr><td>`slug`</td><td>string</td><td>The slug of the media</td></tr><tr><td>`disk`</td><td>string</td><td>The disk used to store the media</td></tr><tr><td>`path`</td><td>string</td><td>The path of the media on the disk</td></tr><tr><td>`title`</td><td>string</td><td>The title of the media</td></tr><tr><td>`type`</td><td>string</td><td>The mimetype of the media</td></tr><tr><td>`extension`</td><td>string</td><td>The file extension of the media</td></tr><tr><td>`size`</td><td>int</td><td>The file size of the media in bytes</td></tr><tr><td>`meta`</td><td>object</td><td>The meta data of the media</td></tr><tr><td>`source`</td><td>string</td><td>The source file name of the media</td></tr><tr><td>`is_protected`</td><td>bool</td><td>Whether the media is protected</td></tr></tbody></table>

##### Settings

Settings are grouped as key-value pairs.

- Use "\_" for ungrouped settings.
- Each group contains its own object of key-value pairs.

```json
{
    "settings": {
        "_": {
            "no_group": "value"
        },
        "group": {
            "key": "value"
        }
    }
}
```

#### Example Request

```
GET /api/specification-groups/{id}
```

#### Example Response

```json
{
    "id": 1,
    "name": "API Test",
    "fields": [
        {
            "name": "Field 1",
            "presets": ["A", "B", "C"],
            "default": "D",
            "prefix": "prefix",
            "suffix": "suffix",
            "media": [],
            "settings": {
                "test": {
                    "test": 123
                }
            }
        }
    ],
    "media": [],
    "settings": {
        "test": {
            "test": 456
        }
    }
}
```

# Create Specification Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/specifications` is installed.</p>

#### Structure

##### Specification Group

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td><td>**Version**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the specification group</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`name`</td><td>string</td><td>The name for the specification group</td><td>Yes</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the specification group</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`fields`</td><td>array</td><td>An array of [Field](https://support.aerocommerce.com/books/api/page/create-specification-group-endpoint#bkmrk-field) objects</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/create-specification-group-endpoint#bkmrk-media) objects</td><td>No</td><td>`>=0.3.2`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/create-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>No</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Field

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td><td>**Version**  
</td></tr><tr><td>`name`</td><td>string</td><td>The name of the field</td><td>Yes</td><td>`>=0.1.0`</td></tr><tr><td>`presets`</td><td>array</td><td>An array of strings to use as preset options</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`default`</td><td>string</td><td>The default value for the field, note: \_p:0 means the first preset</td><td>Yes</td><td>`>=0.1.0`</td></tr><tr><td>`prefix`</td><td>string</td><td>The prefix for the field</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`suffix`</td><td>string</td><td>The suffix for the field</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the field</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/create-specification-group-endpoint#bkmrk-media) objects</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/create-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>No</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Media

<table border="1" id="bkmrk-name-type-descriptio-2" style="border-collapse: collapse; width: 100%; height: 737.907px;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td><td style="height: 29.7969px;">**Required**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the media</td><td>`*`</td></tr><tr><td>`source`</td><td>string</td><td>The source of the media, e.g. test.png</td><td>`*`</td></tr></tbody></table>

`*` At least one must be present.

##### Settings

Settings are grouped as key-value pairs.

- Use "\_" for ungrouped settings.
- Each group contains its own object of key-value pairs.

```json
{
    "settings": {
        "_": {
            "no_group": "value"
        },
        "group": {
            "key": "value"
        }
    }
}
```

#### Example Request

```
POST /api/specification-groups/
```

```json
{
    "name": "API Test",
    "fields": [
        {
            "name": "Field 1",
            "presets": ["A", "B", "C"],
            "default": "D",
            "prefix": "prefix",
            "suffix": "suffix",
            "media": [
                {
                    "id": 1
                }
            ],
            "settings": {
                "test": {
                    "test": "123"
                }
            }
        }
    ],
    "media": [
        {
            "id": 1
        }
    ],
    "settings": {
        "test": {
            "test": "456"
        }
    }
}
```

#### Example Response

```json
{
    "specificationGroup": {
        "id": 1
    }
}
```

# Update Specification Group Endpoint

<p class="callout warning">This endpoint is only available if `aerocargo/specifications` is installed.</p>

#### Structure

##### Specification Group

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td><td>**Version**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the specification group</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`name`</td><td>string</td><td>The name for the specification group</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the specification group</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`fields`</td><td>array</td><td>An array of [Field](https://support.aerocommerce.com/books/api/page/update-specification-group-endpoint/update-specification-group-endpoint#bkmrk-field) objects</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/update-specification-group-endpoint/update-specification-group-endpoint#bkmrk-media) objects</td><td>No</td><td>`>=0.3.2`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/update-specification-group-endpoint/update-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>No</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Field

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col><col style="width: 20.0238%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td><td>**Version**  
</td></tr><tr><td>`name`</td><td>string</td><td>The name of the field</td><td>Yes</td><td>`>=0.1.0`</td></tr><tr><td>`presets`</td><td>array</td><td>An array of strings to use as preset options</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`default`</td><td>string</td><td>The default value for the field, note: \_p:0 means the first preset</td><td>Yes</td><td>`>=0.1.0`</td></tr><tr><td>`prefix`</td><td>string</td><td>The prefix for the field</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`suffix`</td><td>string</td><td>The suffix for the field</td><td>No</td><td>`>=0.1.0`</td></tr><tr><td>`sort`</td><td>int</td><td>The sort for the field</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`media`</td><td>array</td><td>An array of [Media](https://support.aerocommerce.com/books/api/page/update-specification-group-endpoint/update-specification-group-endpoint#bkmrk-media) objects</td><td>No</td><td>`>=1.0.0`</td></tr><tr><td>`settings`</td><td>object</td><td>A [Settings](https://support.aerocommerce.com/books/api/page/update-specification-group-endpoint/update-specification-group-endpoint#bkmrk-settings) object with grouped key-value pairs</td><td>No</td><td>`>=1.0.0`</td></tr></tbody></table>

##### Media

<table border="1" id="bkmrk-name-type-descriptio-2" style="border-collapse: collapse; width: 100%; height: 737.907px;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**  
</td><td style="height: 29.7969px;">**Type**  
</td><td style="height: 29.7969px;">**Description**  
</td><td style="height: 29.7969px;">**Required**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the media</td><td>`*`</td></tr><tr><td>`source`</td><td>string</td><td>The source of the media, e.g. test.png</td><td>`*`</td></tr></tbody></table>

`*` At least one must be present.

##### Settings

Settings are grouped as key-value pairs.

- Use "\_" for ungrouped settings.
- Each group contains its own object of key-value pairs.

```json
{
    "settings": {
        "_": {
            "no_group": "value"
        },
        "group": {
            "key": "value"
        }
    }
}
```

#### Example Request

```
PUT /api/specification-groups/{id}
```

```json
{
    "name": "API Test",
    "fields": [
        {
            "id": 1,
            "name": "Field 1 Updated",
            "presets": ["D", "E", "F"],
            "default": "G"
        }
    ]
}
```

#### Example Response

```json
{
    "specificationGroup": {
        "id": 1
    }
}
```