Specification Groups
- Specification Group Index Endpoint
- View Specification Group Endpoint
- Create Specification Group Endpoint
- Update Specification Group Endpoint
Specification Group Index Endpoint
This endpoint is only available if aerocargo/specifications is installed.
Structure
See View Specification Group for the structure of the specification group payloads inside the data array.
Example Request
GET /api/specification-groups?per_page=2
Example Response
{
"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
}
See View Specification Group for the structure of the specification group payloads inside the data array.
View Specification Group Endpoint
This endpoint is only available if aerocargo/specifications is installed.
Structure
Specification Group
| Name |
Type |
Description |
Version |
id |
int | The id of the specification group | >=0.1.0 |
name |
string | The name for the specification group | >=0.1.0 |
sort |
int | The sort for the specification group | >=1.0.0 |
fields |
array | An array of Field objects | >=0.1.0 |
media |
array | An array of Media objects | >=0.3.2 |
settings |
object | A Settings object with grouped key-value pairs | >=1.0.0 |
Field
| Name |
Type |
Description |
Version |
name |
string | The name of the field | >=0.1.0 |
presets |
array | An array of strings to use as preset options | >=0.1.0 |
default |
string | The default value for the field, note: _p:0 means the first preset |
>=0.1.0 |
prefix |
string | The prefix for the field | >=0.1.0 |
suffix |
string | The suffix for the field | >=0.1.0 |
sort |
int | The sort for the field | >=1.0.0 |
media |
array | An array of Media objects | >=1.0.0 |
settings |
object | A Settings object with grouped key-value pairs | >=1.0.0 |
Media
| Name |
Type |
Description |
id |
int | The id of the media |
slug |
string | The slug of the media |
disk |
string | The disk used to store the media |
path |
string | The path of the media on the disk |
title |
string | The title of the media |
type |
string | The mimetype of the media |
extension |
string | The file extension of the media |
size |
int | The file size of the media in bytes |
meta |
object | The meta data of the media |
source |
string | The source file name of the media |
is_protected |
bool | Whether the media is protected |
Settings
Settings are grouped as key-value pairs.
- Use "_" for ungrouped settings.
- Each group contains its own object of key-value pairs.
{
"settings": {
"_": {
"no_group": "value"
},
"group": {
"key": "value"
}
}
}
Example Request
GET /api/specification-groups/{id}
Example Response
{
"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
This endpoint is only available if aerocargo/specifications is installed.
Structure
Specification Group
| Name |
Type |
Description |
Required |
Version |
id |
int | The id of the specification group | No | >=0.1.0 |
name |
string | The name for the specification group | Yes | >=0.1.0 |
sort |
int | The sort for the specification group | No | >=1.0.0 |
fields |
array | An array of Field objects | No | >=0.1.0 |
media |
array | An array of Media objects | No | >=0.3.2 |
settings |
object | A Settings object with grouped key-value pairs | No | >=1.0.0 |
Field
| Name |
Type |
Description |
Required |
Version |
name |
string | The name of the field | Yes | >=0.1.0 |
presets |
array | An array of strings to use as preset options | No | >=0.1.0 |
default |
string | The default value for the field, note: _p:0 means the first preset | Yes | >=0.1.0 |
prefix |
string | The prefix for the field | No | >=0.1.0 |
suffix |
string | The suffix for the field | No | >=0.1.0 |
sort |
int | The sort for the field | No | >=1.0.0 |
media |
array | An array of Media objects | No | >=1.0.0 |
settings |
object | A Settings object with grouped key-value pairs | No | >=1.0.0 |
Media
| Name |
Type |
Description |
Required |
id |
int | The id of the media | * |
source |
string | The source of the media, e.g. test.png | * |
* 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.
{
"settings": {
"_": {
"no_group": "value"
},
"group": {
"key": "value"
}
}
}
Example Request
POST /api/specification-groups/
{
"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
{
"specificationGroup": {
"id": 1
}
}
Update Specification Group Endpoint
This endpoint is only available if aerocargo/specifications is installed.
Structure
Specification Group
| Name |
Type |
Description |
Required |
Version |
id |
int | The id of the specification group | No | >=0.1.0 |
name |
string | The name for the specification group | No | >=0.1.0 |
sort |
int | The sort for the specification group | No | >=1.0.0 |
fields |
array | An array of Field objects | No | >=0.1.0 |
media |
array | An array of Media objects | No | >=0.3.2 |
settings |
object | A Settings object with grouped key-value pairs | No | >=1.0.0 |
Field
| Name |
Type |
Description |
Required |
Version |
name |
string | The name of the field | Yes | >=0.1.0 |
presets |
array | An array of strings to use as preset options | No | >=0.1.0 |
default |
string | The default value for the field, note: _p:0 means the first preset | Yes | >=0.1.0 |
prefix |
string | The prefix for the field | No | >=0.1.0 |
suffix |
string | The suffix for the field | No | >=0.1.0 |
sort |
int | The sort for the field | No | >=1.0.0 |
media |
array | An array of Media objects | No | >=1.0.0 |
settings |
object | A Settings object with grouped key-value pairs | No | >=1.0.0 |
Media
| Name |
Type |
Description |
Required |
id |
int | The id of the media | * |
source |
string | The source of the media, e.g. test.png | * |
* 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.
{
"settings": {
"_": {
"no_group": "value"
},
"group": {
"key": "value"
}
}
}
Example Request
PUT /api/specification-groups/{id}
{
"name": "API Test",
"fields": [
{
"id": 1,
"name": "Field 1 Updated",
"presets": ["D", "E", "F"],
"default": "G"
}
]
}
Example Response
{
"specificationGroup": {
"id": 1
}
}