# Product

## Module endpoints

* [`DELETE /products/:id`](#delete-products-id)​
* [`DELETE /products/:productId/questions/:id`](#delete-products-productid-questions-id)​
* ​[`GET /products`](#get-invites)​
* ​[`GET /products/:id`](#get-products-id)​
* ​[`PATCH /products/:id`](#patch-products-id)​
* ​[`POST /products`](#post-products)​
* [`POST /products/:id/questions`](#post-products-id-questions)
* [`POST /products/:id/reorder`](#post-products-id-reorder)
* [`POST /products/:productId/questions/:id/reorder`](#post-products-productid-questions-id-reorder)

### `DELETE /products/:id`

> `DELETE` <http://api.slyk.i&#x6F;**/products/:id>\*\*

Deletes the `product` with given `id`.

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `DELETE /products/:productId/questions/:id`

> `DELETE` <http://api.slyk.i&#x6F;**/products/:productId/questions/:id>\*\*

Deletes the `product question` with given `id` and `productId`.

{% tabs %}
{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `GET /products` <a href="#get-invites" id="get-invites"></a>

> `GET` <https://api.slyk.i&#x6F;**/products>\*\*

Returns a paginated list of `products`.

{% tabs %}
{% tab title="Available Filters" %}

| Name                 |                              Type                             | Example                                           |
| -------------------- | :-----------------------------------------------------------: | ------------------------------------------------- |
| **available**        |                              `=`                              | `filter[available]=true`                          |
| **categoryId**       |                         `=` `in` `nin`                        | `filter[categoryId]=in:foo,bar`                   |
| **description**      |                            `ilike`                            | `filter[description]=foo`                         |
| **featured**         |                              `=`                              | `filter[featured]=false`                          |
| **id**               |                         `=` `in` `nin`                        | `filter[id]=7938e446-1c77-4513-8cb0-8b1f2e9f47b9` |
| **name**             |                            `ilike`                            | `filter[name]=foo`                                |
| **order**            | <p><code>=</code></p><p><code>gte</code> <code>lte</code></p> | `filter[order]=gte:0.5`                           |
| **requiresIdentity** |                              `=`                              | `filter[requiresIdentity]=true`                   |
| **typeCode**         |                         `=` `in` `nin`                        | `filter[typeCode]=nin:bar`                        |
| **visible**          |                              `=`                              | `filter[visible]=true`                            |
| {% endtab %}         |                                                               |                                                   |

{% tab title="Available Sorts" %}

| Name          | Example                                                            |
| ------------- | ------------------------------------------------------------------ |
| **createdAt** | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p> |
| **featured**  | <p><code>sort=featured</code><br><code>sort=-featured</code></p>   |
| **order**     | <p><code>sort=order</code><br><code>sort=-order</code></p>         |
| {% endtab %}  |                                                                    |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "allowChoosingQuantity": true,
      "assetCode": "eur",
      "available": true,
      "bonus": "1.34000000",
      "buttonLabel": "bar",
      "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Pop music album",
      "featured": false,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "imageUrl": "http://slyk.io/album.png",
      "listLabel": "biz",
      "metadata": {},
      "name": "Music album",
      "price": "2.50000000",
      "priceWithTax": "3.00000000",
      "requiresIdentity": false,
      "taxAmount": "0.50000000",
      "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "thumbnailUrl": "http://slyk.io/album-thumbnail.png",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "url": "http://albums.com",
      "visible": true
    },
    {
      "allowChoosingQuantity": true,
      "assetCode": "eur",
      "available": true,
      "bonus": "1.74000000",
      "buttonLabel": "biz",
      "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Pop music t-shirt",
      "featured": true,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c9",
      "imageUrl": "http://slyk.io/tshirt.png",
      "listLabel": "bar",
      "metadata": {},
      "name": "Music t-shirt",
      "price": "6.50000000",
      "priceWithTax": "6.80000000",
      "requiresIdentity": false,
      "taxAmount": "0.30000000",
      "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "thumbnailUrl": "http://slyk.io/tshirt-thumbnail.png",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "url": "http://tshirts.com",
      "visible": true
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /products/:id`

> `GET` <https://api.slyk.i&#x6F;**/products/:id**‌>

Gets the product details of the given `id`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
      "allowChoosingQuantity": true,
      "assetCode": "eur",
      "available": true,
      "bonus": "1.34000000",
      "buttonLabel": "biz",
      "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Pop music t-shirt",
      "featured": false,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "imageUrl": "http://slyk.io/tshirt.png",
      "listLabel": "bar",
      "metadata": {},
      "name": "Music t-shirt",
      "price": "2.50000000",
      "priceWithTax": "2.80000000",
      "requiresIdentity": false,
      "taxAmount": "0.30000000",
      "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "thumbnailUrl": "http://slyk.io/tshirt-thumbnail.png",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "url": "http://tshirts.com",
      "visible": true
    }
}
```

{% endtab %}
{% endtabs %}

### `PATCH /products/:id`

> `PATCH` <https://api.slyk.i&#x6F;**/products/:id>\*\*

Patches the `product` details of the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field                     |    Type   | Required | Description                                             |
| ------------------------- | :-------: | :------: | ------------------------------------------------------- |
| **allowChoosingQuantity** | `boolean` |  `false` | Product choosing quantity allow indicator.              |
| **assetCode**             |  `string` |  `false` | Asset code related to the product.                      |
| **available**             | `boolean` |  `false` | Product availability indicator.                         |
| **bonus**                 |  `string` |  `false` | Product bonus value.                                    |
| **buttonLabel**           |  `string` |  `false` | Product button label.                                   |
| **categoryId**            |  `string` |  `false` | Associated category identifier. Format: `uuid`.         |
| **customData**            |  `object` |  `false` | Can store any additional information about the product. |
| **description**           |  `string` |  `false` | Product description.                                    |
| **featured**              | `boolean` |  `false` | Product featuring indicator.                            |
| **image**                 |  `string` |  `false` | Product image.                                          |
| **listLabel**             |  `string` |  `false` | Product list label.                                     |
| **name**                  |  `string` |  `false` | Product name.                                           |
| **order**                 |  `string` |  `false` | Product order value.                                    |
| **price**                 |  `string` |  `false` | Product price value.                                    |
| **requiresIdentity**      | `boolean` |  `false` | Identity required indicator.                            |
| **taxRateId**             |  `string` |  `false` | Associated tax rate identifier. Format: `uuid`.         |
| **thumbnail**             |  `string` |  `false` | Product thumbnail.                                      |
| **url**                   |  `string` |  `false` | Product URL.                                            |
| **visible**               | `boolean` |  `false` | Product visibility indicator.                           |
| {% endtab %}              |           |          |                                                         |

{% tab title="Request" %}

```javascript
{
  "available": true,
  "bonus": "1.34000000",
  "description": "Pop music t-shirt",
  "image": "tshirt.png",
  "name": "Music t-shirt",
  "url": "http://tshirts.com"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
      "allowChoosingQuantity": true,
      "assetCode": "eur",
      "available": true,
      "bonus": "1.34000000",
      "buttonLabel": "biz",
      "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Pop music t-shirt",
      "featured": false,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "imageUrl": "http://slyk.io/tshirt.png",
      "listLabel": "bar",
      "metadata": {},
      "name": "Music t-shirt",
      "price": "2.50000000",
      "priceWithTax": "2.80000000",
      "requiresIdentity": false,
      "taxAmount": "0.30000000",
      "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "thumbnailUrl": "http://slyk.io/tshirt-thumbnail.png",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "url": "http://tshirts.com",
      "visible": true
    }
}
```

{% endtab %}
{% endtabs %}

### `POST /products`

> `POST` <https://api.slyk.i&#x6F;**/products>\*\*

Creates a new `product`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field                     |    Type   | Required | Description                                             |
| ------------------------- | :-------: | :------: | ------------------------------------------------------- |
| **allowChoosingQuantity** | `boolean` |  `false` | Product choosing quantity allow indicator.              |
| **assetCode**             |  `string` |  `false` | Asset code related to the product.                      |
| **available**             | `boolean` |  `false` | Product availability indicator.                         |
| **bonus**                 |  `string` |  `false` | Product bonus value.                                    |
| **buttonLabel**           |  `string` |  `false` | Product button label.                                   |
| **categoryId**            |  `string` |  `true`  | Associated category identifier. Format: `uuid`.         |
| **customData**            |  `object` |  `false` | Can store any additional information about the product. |
| **description**           |  `string` |  `false` | Product description.                                    |
| **featured**              | `boolean` |  `false` | Product featuring indicator.                            |
| **image**                 |  `string` |  `false` | Product image.                                          |
| **listLabel**             |  `string` |  `false` | Product list label.                                     |
| **name**                  |  `string` |  `false` | Product name.                                           |
| **order**                 |  `string` |  `false` | Product order value.                                    |
| **price**                 |  `string` |  `true`  | Product price value.                                    |
| **requiresIdentity**      | `boolean` |  `false` | Identity required indicator.                            |
| **taxRateId**             |  `string` |  `false` | Associated tax rate identifier. Format: `uuid`.         |
| **thumbnail**             |  `string` |  `false` | Product thumbnail.                                      |
| **url**                   |  `string` |  `false` | Product URL.                                            |
| **visible**               | `boolean` |  `false` | Product visibility indicator.                           |
| {% endtab %}              |           |          |                                                         |

{% tab title="Request" %}

```javascript
{
    "allowChoosingQuantity": true,
    "assetCode": "eur",
    "available": true,
    "bonus": "1.34000000",
    "buttonLabel": "qux",
    "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3",
    "description": "Pop music t-shirt",
    "featured": false,
    "image": "tshirt.png",
    "listLabel": "quux",
    "name": "Music t-shirt",
    "price": "2.50000000",
    "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
    "thumbnail": "tshirt-thumbnail.png",
    "url": "http://tshirts.com",
    "visible": true
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
      "allowChoosingQuantity": true,
      "assetCode": "eur",
      "available": true,
      "bonus": "1.34000000",
      "buttonLabel": "qux",
      "categoryId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c5",
      "createdAt": "2020-08-10T10:00:00.000Z",
      "customData": {},
      "description": "Pop music t-shirt",
      "featured": false,
      "id": "fc78d28f-a8dd-49de-a22f-722fe3bd26c8",
      "imageUrl": "http://slyk.io/tshirt.png",
      "listLabel": "quux",
      "metadata": {},
      "name": "Music t-shirt",
      "price": "2.50000000",
      "priceWithTax": "2.80000000",
      "requiresIdentity": false,
      "taxAmount": "0.30000000",
      "taxRateId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c4",
      "thumbnailUrl": "http://slyk.io/tshirt-thumbnail.png",
      "updatedAt": "2020-08-10T10:00:00.000Z",
      "url": "http://tshirts.com",
      "visible": true
    }
}
```

{% endtab %}
{% endtabs %}

### `POST /products/:id/questions`

> `POST` <http://api.slyk.i&#x6F;**/products/:id/questions>\*\*

Creates a new `product question`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field          |   Type   | Required | Description                                     |
| -------------- | :------: | :------: | ----------------------------------------------- |
| **questionId** | `string` |  `true`  | Associated question identifier. Format: `uuid`. |
| {% endtab %}   |          |          |                                                 |

{% tab title="Request" %}

```javascript
{
    "questionId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "order": "1",
    "productId": "ec78d28f-a8dd-49de-a32f-722fe3bd26c8",
    "questionId": "fc78d28f-a8dd-49de-a22f-722fe3bd26c3"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /products/:id/reorder`

> `POST` <http://api.slyk.i&#x6F;**/products/:id/reorder>\*\*

Reorders the `product` with the given `id`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field            |   Type   | Required | Description                    |
| ---------------- | :------: | :------: | ------------------------------ |
| **subsequentId** | `string` |  `false` | Subsequent product identifier. |
| {% endtab %}     |          |          |                                |

{% tab title="Request" %}

```javascript
{
  "subsequentId": "174c3e0d-226f-443a-a010-12b2140de03c"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}

### `POST /products/:productId/questions/:id/reorder`

> `POST` <http://api.slyk.i&#x6F;**/products/:productId/questions/:id/reorder>\*\*

Reorders the `product question` with the given `id` and `productId`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field            |   Type   | Required | Description                             |
| ---------------- | :------: | :------: | --------------------------------------- |
| **subsequentId** | `string` |  `false` | Subsequent product question identifier. |
| {% endtab %}     |          |          |                                         |

{% tab title="Request" %}

```javascript
{
  "subsequentId": "174c3e0d-226f-443a-a010-12b2140de03c"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}
