> For the complete documentation index, see [llms.txt](https://docs.fakestoreapi.ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fakestoreapi.ru/api-reference/api-product.md).

# Product

## Authentication

* HTTP Authentication, scheme: bearer

## Product <a href="#fake-store-api-product" id="fake-store-api-product"></a>

### Get list of products

> Code samples

```javascript
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', 'https://fakestoreapi.ru/product');
xhr.setRequestHeader('Accept', 'application/json');

xhr.send(data);
```

`GET /product`

#### Parameters <a href="#get-list-of-products-parameters" id="get-list-of-products-parameters"></a>

\| Name | In | Type | Required | Description | | ------- | ----- | ------ | -------- | ------------------------------------ | ------ | | l | query | number | false | Items limit on page ( from 1 to 50 ) | | p | query | number | false | Items page ( min 1 ) | | n | query | string | false | Product name | | orderBy | query | string | false | Sort by ( name, price, discount ) | | sort | query | string | false | Sort method ( ASC | DESC ) | | pfrom | query | number | false | Product price from ( min 0 ) | | pto | query | number | false | Product price to ( min 1 ) | | cn | query | string | false | Product category name | | cid | query | string | false | Product category id |

> Example responses

> 200 Response

```json
{
  "data": [
    {
      "uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
      "name": "Nike",
      "price": 250,
      "discount": 15,
      "images": [
        {
          "_uuid": "string"
        }
      ],
      "rating": 0,
      "review_count": 0,
      "category": {
        "_uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
        "name": "Shoes"
      }
    }
  ],
  "price_range": {
    "min": 100,
    "max": 5000
  },
  "pagintaion": {
    "total": 240,
    "page": 1,
    "limit": 10,
    "totalPage": 24,
    "isLastPage": false
  }
}
```

#### Responses <a href="#get-list-of-products-responses" id="get-list-of-products-responses"></a>

| Status | Meaning                                                 | Description            | Schema                                                |
| ------ | ------------------------------------------------------- | ---------------------- | ----------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Products recived       | [ProductsListDetails](/models/productslistdetails.md) |
| 5XX    | Unknown                                                 | Server error           | None                                                  |
| 4XX    | Unknown                                                 | Check response message | None                                                  |

This operation does not require authentication

### Create product

> Code samples

`POST /product`

> Body parameter

```yaml
name: New Balance 1906
price: 1000
categoryId: 17a54659-a06a-464f-a914-190cee7d4b1a
discount: 25
images:
  - []
```

#### Parameters <a href="#create-product-parameters" id="create-product-parameters"></a>

| Name | In   | Type                                            | Required | Description |
| ---- | ---- | ----------------------------------------------- | -------- | ----------- |
| body | body | [CreateProductDto](/models/createproductdto.md) | true     | none        |

> Example responses

> 201 Response

```json
{
  "uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
  "name": "Nike",
  "price": 250,
  "discount": 15,
  "images": [
    {
      "_uuid": "string"
    }
  ],
  "rating": 0,
  "review_count": 0,
  "category": {
    "_uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
    "name": "Shoes"
  }
}
```

#### Responses <a href="#create-product-responses" id="create-product-responses"></a>

| Status | Meaning                                                      | Description            | Schema                                      |
| ------ | ------------------------------------------------------------ | ---------------------- | ------------------------------------------- |
| 201    | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Product created        | [ProductDetails](/models/productdetails.md) |
| 5XX    | Unknown                                                      | Server error           | None                                        |
| 4XX    | Unknown                                                      | Check response message | None                                        |

To perform this operation, you must be authenticated by means of one of the following methods: bearer

### Get product by id

> Code samples

```javascript
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', 'https://fakestoreapi.ru/product/string');
xhr.setRequestHeader('Accept', 'application/json');

xhr.send(data);
```

`GET /product/{id}`

#### Parameters <a href="#get-product-by-id-parameters" id="get-product-by-id-parameters"></a>

| Name | In   | Type   | Required | Description |
| ---- | ---- | ------ | -------- | ----------- |
| id   | path | string | true     | Product id  |

> Example responses

> 200 Response

```json
{
  "uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
  "name": "Nike",
  "price": 250,
  "discount": 15,
  "images": [
    {
      "_uuid": "string"
    }
  ],
  "rating": 0,
  "review_count": 0,
  "category": {
    "_uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
    "name": "Shoes"
  }
}
```

#### Responses <a href="#get-product-by-id-responses" id="get-product-by-id-responses"></a>

| Status | Meaning                                                 | Description            | Schema                                      |
| ------ | ------------------------------------------------------- | ---------------------- | ------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product recived        | [ProductDetails](/models/productdetails.md) |
| 5XX    | Unknown                                                 | Server error           | None                                        |
| 4XX    | Unknown                                                 | Check response message | None                                        |

This operation does not require authentication

### Update product

> Code samples

`PATCH /product/{id}`

> Body parameter

```yaml
name: New Balance 1906
price: 1000
discount: 25
removeImages:
  - 17a54659-a06a-464f-a914-190cee7d4b1a
  - 17a54659-a06a-464f-a914-190cee7d4b1a
images:
  - []
```

#### Parameters <a href="#update-product-parameters" id="update-product-parameters"></a>

| Name | In   | Type                                            | Required | Description |
| ---- | ---- | ----------------------------------------------- | -------- | ----------- |
| id   | path | string                                          | true     | Product id  |
| body | body | [UpdateProductDto](/models/updateproductdto.md) | true     | none        |

#### Responses <a href="#update-product-responses" id="update-product-responses"></a>

| Status | Meaning                                                 | Description            | Schema |
| ------ | ------------------------------------------------------- | ---------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product updated        | None   |
| 5XX    | Unknown                                                 | Server error           | None   |
| 4XX    | Unknown                                                 | Check response message | None   |

To perform this operation, you must be authenticated by means of one of the following methods: bearer

### Remove product

> Code samples

```javascript
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('DELETE', 'https://fakestoreapi.ru/product/string');
xhr.setRequestHeader('Authorization', 'Bearer {access-token}');

xhr.send(data);
```

`DELETE /product/{id}`

#### Parameters <a href="#remove-product-parameters" id="remove-product-parameters"></a>

| Name | In   | Type   | Required | Description |
| ---- | ---- | ------ | -------- | ----------- |
| id   | path | string | true     | Product id  |

#### Responses <a href="#remove-product-responses" id="remove-product-responses"></a>

| Status | Meaning                                                 | Description            | Schema |
| ------ | ------------------------------------------------------- | ---------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product removed        | None   |
| 5XX    | Unknown                                                 | Server error           | None   |
| 4XX    | Unknown                                                 | Check response message | None   |

To perform this operation, you must be authenticated by means of one of the following methods: bearer

### Get reviews by product id

> Code samples

```javascript
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', 'https://fakestoreapi.ru/product/string/review');
xhr.setRequestHeader('Accept', 'application/json');

xhr.send(data);
```

`GET /product/{id}/review`

#### Parameters <a href="#get-reviews-by-product-id-parameters" id="get-reviews-by-product-id-parameters"></a>

| Name | In    | Type   | Required | Description                          |
| ---- | ----- | ------ | -------- | ------------------------------------ |
| l    | query | number | false    | Items limit on page ( from 1 to 50 ) |
| p    | query | number | false    | Items page ( min 1 )                 |
| id   | path  | string | true     | Product id                           |

> Example responses

> 200 Response

```json
{
  "data": [
    {
      "_uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
      "content": "Best shoes",
      "rating": 5,
      "user": {}
    }
  ],
  "pagintaion": {
    "total": 240,
    "page": 1,
    "limit": 10,
    "totalPage": 24,
    "isLastPage": false
  }
}
```

#### Responses <a href="#get-reviews-by-product-id-responses" id="get-reviews-by-product-id-responses"></a>

| Status | Meaning                                                 | Description            | Schema                                            |
| ------ | ------------------------------------------------------- | ---------------------- | ------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Reviews recived        | [ReviewListDetails](/models/reviewlistdetails.md) |
| 5XX    | Unknown                                                 | Server error           | None                                              |
| 4XX    | Unknown                                                 | Check response message | None                                              |

This operation does not require authentication

### Create product review

> Code samples

```javascript
const data = JSON.stringify({
  content: 'Best shoes',
  rating: 5,
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', 'https://fakestoreapi.ru/product/string/review');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Accept', 'application/json');

xhr.send(data);
```

`POST /product/{id}/review`

> Body parameter

```json
{
  "content": "Best shoes",
  "rating": 5
}
```

#### Parameters <a href="#create-product-review-parameters" id="create-product-review-parameters"></a>

| Name | In   | Type                                          | Required | Description |
| ---- | ---- | --------------------------------------------- | -------- | ----------- |
| id   | path | string                                        | true     | Product id  |
| body | body | [CreateReviewDto](/models/createreviewdto.md) | true     | none        |

> Example responses

> 200 Response

```json
{
  "_uuid": "17a54659-a06a-464f-a914-190cee7d4b1a",
  "content": "Best shoes",
  "rating": 5,
  "user": {}
}
```

#### Responses <a href="#create-product-review-responses" id="create-product-review-responses"></a>

| Status | Meaning                                                 | Description            | Schema                                    |
| ------ | ------------------------------------------------------- | ---------------------- | ----------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product review created | [ReviewDetails](/models/reviewdetails.md) |
| 5XX    | Unknown                                                 | Server error           | None                                      |
| 4XX    | Unknown                                                 | Check response message | None                                      |

This operation does not require authentication

### Update product review

> Code samples

```javascript
const data = JSON.stringify({
  content: 'Best shoes',
  rating: 5,
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('PATCH', 'https://fakestoreapi.ru/product/string/review/string');
xhr.setRequestHeader('Content-Type', 'application/json');

xhr.send(data);
```

`PATCH /product/{prodid}/review/{reviewid}`

> Body parameter

```json
{
  "content": "Best shoes",
  "rating": 5
}
```

#### Parameters <a href="#update-product-review-parameters" id="update-product-review-parameters"></a>

| Name     | In   | Type                                          | Required | Description |
| -------- | ---- | --------------------------------------------- | -------- | ----------- |
| prodid   | path | string                                        | true     | none        |
| reviewid | path | string                                        | true     | none        |
| id       | path | string                                        | true     | Product id  |
| body     | body | [UpdateReviewDto](/models/updatereviewdto.md) | true     | none        |

#### Responses <a href="#update-product-review-responses" id="update-product-review-responses"></a>

| Status | Meaning                                                 | Description            | Schema |
| ------ | ------------------------------------------------------- | ---------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product review updated | None   |
| 5XX    | Unknown                                                 | Server error           | None   |
| 4XX    | Unknown                                                 | Check response message | None   |

This operation does not require authentication

### Delete product review

> Code samples

```javascript
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('DELETE', 'https://fakestoreapi.ru/product/string/review/string');

xhr.send(data);
```

`DELETE /product/{prodid}/review/{reviewid}`

#### Parameters <a href="#delete-product-review-parameters" id="delete-product-review-parameters"></a>

| Name     | In   | Type   | Required | Description |
| -------- | ---- | ------ | -------- | ----------- |
| prodid   | path | string | true     | none        |
| reviewid | path | string | true     | none        |
| id       | path | string | true     | Product id  |

#### Responses <a href="#delete-product-review-responses" id="delete-product-review-responses"></a>

| Status | Meaning                                                 | Description            | Schema |
| ------ | ------------------------------------------------------- | ---------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Product review deleted | None   |
| 5XX    | Unknown                                                 | Server error           | None   |
| 4XX    | Unknown                                                 | Check response message | None   |

This operation does not require authentication
