# Product Catalogue

## **List catalogues**

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/list/catalogue/`

This API endpoint will return a list of product catalogue&#x20;

#### Query Parameters

| Name   | Type   | Description                                                                                                        |
| ------ | ------ | ------------------------------------------------------------------------------------------------------------------ |
| offset | string | The offset indicates the starting position of the query in relation to the complete set of unpaginated items.      |
| limit  | string | The limit indicates the maximum number of items to return, default maximum number is 50, and maximum limit is 100. |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "id": <catalogue_id>,
                "name": "<catalogue_name>",
                "parent_id": <parent_id>,
                "image": "<image_path>",
                "parent": {
                    "id": <parent_id>,
                    "name": "<parent_name>"
                },
                "translation": [
                    {
                        "name": "<catalogue_name>",
                        "language_code": "<language_code>",
                        "entity_id": <entity_id>
                    }
                    ...
                ]
            },
            ...
        ],
        "count": <list_count>,
        "previous": "<link_for_previous_page_list>",
        "next": "<link_for_next_page_list>"
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/catalogue/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/list/catalogue/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

## Create C**atalogue**

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/create/catalogue/`

This API endpoint will create a product catalogue

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| apikey<mark style="color:red;">\*</mark>        | string | apikey             |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer acces token |

#### Request Body

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| name<mark style="color:red;">\*</mark>       | string | Name of catalogue      |
| parent\_id<mark style="color:red;">\*</mark> | string | Parent id of catalogue |

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

```markup
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/create/catalogue/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {
    'name ': '<catalogue_name>',
    'parent_id': '<parent_id>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/create/catalogue/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('name ' => '<catalogue_name>','parent_id' => '<parent_name>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field      | Description                                                                                                                                                                                         |
| ----------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | name       | <p>This field is required.</p><p>This field may not be blank.</p><p>Ensure this field has no more than 200 characters.</p><p>""Catalogue name already selected. Please choose different name !"</p> |
| 400         | Validation Error | parent\_id | <p>Parent id is required</p><p>This field may not be blank</p><p>Incorrect type. Expected pk value, received str.</p><p>Invalid pk "parent\_id" - object does not exist.</p>                        |

## Update Catalogue

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/update/catalogue/`

This API endpoint will update a product catalogue.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                         | Type   | Description                             |
| -------------------------------------------- | ------ | --------------------------------------- |
| id<mark style="color:red;">\*</mark>         | string | Catalogue id                            |
| name<mark style="color:red;">\*</mark>       | string | New name or existing name of catalogue. |
| parent\_id<mark style="color:red;">\*</mark> | string | Parent id                               |

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

```
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/update/catalogue/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {
    'id': '<catalogue_id>',
    'name': '<name>',
    'parent_id': '<parent_catalogue_id>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/update/catalogue/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('id' => '<catalogue_id>','name' => '<name>','parent_id' => '<parent_catalogue_id>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code                                    | Error Type    | Field | Description                                                                                                                          |
| ---------------------------------------------- | ------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------ |
| 400                                            | Invalid Input | id    | <p>Catalogue id is required.</p><p>This field may not be blank.</p><p>Catalogue id is not valid.</p><p>Catalogue does not exist.</p> |
| All other error responses of create catalogue. |               |       |                                                                                                                                      |

## Delete Catalogue

<mark style="color:red;">`DELETE`</mark> `‎https://<domain>/<api prefix>/<version>/commerce/product/delete/catalogue/?id=<id>`

This API endpoint will delete a product catalogue.

#### Query Parameters

| Name                                 | Type   | Description  |
| ------------------------------------ | ------ | ------------ |
| id<mark style="color:red;">\*</mark> | string | Catalogue id |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```
​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/catalogue/?id=<id>',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/delete/catalogue/?id=<id>",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type     | FIeld | Description                                                                                                                   |
| ----------- | -------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------- |
| 401         | Request Failed |       | Catalogue can't delete or remove                                                                                              |
| 400         | Invalid Input  | id    | <p>Catalogue id is not valid.</p><p>Catalogue does not exist.<br>This field may not be blank<br>Catalogue id is required.</p> |


---

# 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://api.epixelsoftware.help/product-catalogue.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.
