# Whishlist

## Get wishlist items

<mark style="color:blue;">`GET`</mark> `https://<domain>/<api prefix>/<version>/commerce/wishlist-items/`

get the list of items in wishlist

#### Query Parameters

| Name   | Type   | Description  |
| ------ | ------ | ------------ |
| offset | string | Offset value |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | api-key             |
| 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": [
        {
            "wished_products": <items>,
            "currency_symbol": <currency_symbol>
        }
    ]
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

#### Node

```javascript
var request = require("request");

var options = { method: 'GET',
  url: 'https://<domain>/<api prefix>/<version>/commerce/wishlist-items/',
  headers: 
   { authorization: 'Bearer <access-token>',
     apikey: '<apikey>',
     'content-type': 'multipart/form-data' },
  formData: { order_id: '9558', pk: '' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8000",
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/wishlist-items/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"order_id\"\r\n\r\n9558\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"pk\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "authorization: Bearer <access-token>",
    "content-type: multipart/form-data;",    
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

## Add to wishlist

<mark style="color:green;">`POST`</mark> `https://<domain>/<api prefix>/<version>/commerce/wishlist-add/`

add product to wishlist

#### Headers

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

#### Request Body

| Name                                          | Type    | Description |
| --------------------------------------------- | ------- | ----------- |
| product\_id<mark style="color:red;">\*</mark> | integer | product\_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

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/commerce/wishlist-add/',
  'headers': {
    'apikey': '<api key>',
    'Authorization': 'Bearer <access-token>',
  },
  formData: {
    'product_id': '<product_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/wishlist-add/',
  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('product_id' => '<product_id>'),
  CURLOPT_HTTPHEADER => array(
    'apikey: <api key>',
    'Authorization: Bearer <access-token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status code | Error Type       | Field       | Description             |
| ----------- | ---------------- | ----------- | ----------------------- |
| 400         | Validation Error | product\_id | This field is required. |
| 400         | Validation Error | product\_id | Invalid product\_id.    |

## Remove item from the wishlist

<mark style="color:green;">`POST`</mark> `https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/`

remove a specific item from wishlist

#### 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: 'POST',
  url: 'https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/',
  headers: 
   { authorization: 'Bearer <access-token>',
     apikey: '<apikey>',
     'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' },
  formData: { product_id: '<product_id>' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8000",
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"product_id\"\r\n\r\n<product_id>\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "authorization: Bearer <access-token>",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

#### Error Responses

| Status Code | Error Type       | Field             | Description                  |
| ----------- | ---------------- | ----------------- | ---------------------------- |
| 400         | Validation Error | product\_id       | This field may not be blank. |
| 400         | Not Found        | product not found | Product not found            |


---

# 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/whishlist.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.
