# Products

## List all sales products

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales_products`

This endpoint allows you to get the list of your sales. \
The transactions are returned sorted by most recent number.

#### Headers

| Name                                             | Type   | Description                  |
| ------------------------------------------------ | ------ | ---------------------------- |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer Token                 |
| Accept                                           | string | Should be `application/json` |

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

```json
{
  "data": [
    {
      "id": 2,
      "sale_id": 5,
      "product_id": 2,
      "product_name": "Default service",
      "product_description": "",
      "product_quantity": "1.00",
      "produit_quantite3": "0.00",
      "produit_poids": "0.000",
      "product_price": "100.0000",
      "product_cost": "0.00",
      "product_discount": "0.0000",
      "product_serialnumber": "",
      "produit_total": "100.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 9
    },
    {
      "id": 1,
      "sale_id": 5,
      "product_id": 3,
      "product_name": "PARTS",
      "product_description": "",
      "product_quantity": "1.00",
      "produit_quantite3": "0.00",
      "produit_poids": "0.000",
      "product_price": "200.0000",
      "product_cost": "0.00",
      "product_discount": "0.0000",
      "product_serialnumber": "",
      "produit_total": "200.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 9
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 500,
    "total": 2
  },
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve a specific sale product

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/sales_products/:id`

This endpoint allows you to get one specific sale product.&#x20;

#### Path Parameters

| Name | Type    | Description                              |
| ---- | ------- | ---------------------------------------- |
| id   | integer | The ID of the sales product to retrieve. |

#### Headers

| Name                                             | Type   | Description                  |
| ------------------------------------------------ | ------ | ---------------------------- |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer Token                 |
| Accept                                           | string | Should be `application/json` |

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

```json
{
  "data": [
    {
      "id": 1,
      "sale_id": 5,
      "product_id": 3,
      "product_name": "PARTS",
      "product_description": "",
      "product_quantity": "1.00",
      "produit_quantite3": "0.00",
      "produit_poids": "0.000",
      "product_price": "200.0000",
      "product_cost": "0.00",
      "product_discount": "0.0000",
      "product_serialnumber": "",
      "produit_total": "200.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 9
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

## Create a sale product

<mark style="color:green;">`POST`</mark> `https://app.gem-books.com/api/sales_products`

#### Headers

| Name           | Type   | Description                  |
| -------------- | ------ | ---------------------------- |
| Authentication | string | Bearer Token                 |
| Content-type   | string | Should be application/json   |
| Accept         | string | Should be `application/json` |

#### Request Body

| Name        | Type   | Description       |
| ----------- | ------ | ----------------- |
| sale\_id    | string | Invoice ID        |
| product\_id | string | Payment method ID |

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

```json
{
  "data": [
    {
      "id": 12,
      "sale_id": 5,
      "product_id": 1461,
      "product_name": "Produit par défaut",
      "product_description": "",
      "product_quantity": "0.00",
      "produit_quantite3": "0.00",
      "produit_poids": "0.000",
      "product_price": "0.0000",
      "product_cost": "0.00",
      "product_discount": "0.0000",
      "product_serialnumber": "",
      "produit_total": "0.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 9
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```
{
    "sale_id": 5,
    "product_id": 1461
}
```

## Update a sale product

<mark style="color:orange;">`PUT`</mark> `https://app.gem-books.com/api/sales_products/:id`

This endpoint allows you to update a specific sales product. \
Returns the updated sales product.

#### Path Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| id   | integer | Sales product ID to update. |

#### Headers

| Name           | Type   | Description                  |
| -------------- | ------ | ---------------------------- |
| Authentication | string | Bearer Token                 |
| Content-Type   | string | Should be `application/json` |
| Accept         | string | Should be `application/json` |

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

```json
{
  "data": [
    {
      "id": 12,
      "sale_id": 5,
      "product_id": 1461,
      "product_name": "alignment",
      "product_description": "",
      "product_quantity": "1.00",
      "produit_quantite3": "0.00",
      "produit_poids": "0.000",
      "product_price": "60.0000",
      "product_cost": "0.00",
      "product_discount": "0.0000",
      "product_serialnumber": "",
      "produit_total": "60.00",
      "taxes_rules_id": 2,
      "gestion_taxes": "[]",
      "province_id": 9
    }
  ],
  "success": true
}
```

{% endtab %}
{% endtabs %}

#### Body Example

```
{
    "product_name": "alignment",
    "product_price": 60
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gem-suite.com/api-reference/resources/sales/products.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
