Whishlist

Manage wishlist

Get wishlist items

get
​

https://<domain>/<api prefix>/<version>/commerce/wishlist-items/
get the list of items in wishlist
Request
Response
Request
Headers
apikey
required
string
api-key
Authorization
required
string
Bearer access-token
Query Parameters
offset
optional
string
Offset value
Response
200: OK
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": [
{
"wished_products": <items>,
"currency_symbol": <currency_symbol>
}
]
}

Sample Code

Node

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
​
$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

post
​

https://<domain>/<api prefix>/<version>/commerce/wishlist-add/
add product to wishlist
Request
Response
Request
Headers
apikey
required
string
api key
Authorization
required
string
Bearer access token
Body Parameters
product_id
required
integer
product_id
Response
200: OK
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}

Sample Code

Node

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
​
$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

post
​

https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/
remove a specific item from wishlist
Request
Response
Request
Headers
apikey
optional
string
apikey
Authorization
optional
string
Bearer access token
Response
200: OK
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}

Sample code

Node

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
​
$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

​