Whishlist
Manage wishlist

Get wishlist items

get
https://<domain>/<api prefix>/<version>/commerce/wishlist-items/

Sample Code

Node

1
var request = require("request");
2
​
3
var options = { method: 'GET',
4
url: 'https://<domain>/<api prefix>/<version>/commerce/wishlist-items/',
5
headers:
6
{ authorization: 'Bearer <access-token>',
7
apikey: '<apikey>',
8
'content-type': 'multipart/form-data' },
9
formData: { order_id: '9558', pk: '' } };
10
​
11
request(options, function (error, response, body) {
12
if (error) throw new Error(error);
13
​
14
console.log(body);
15
});
Copied!

PHP

1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_PORT => "8000",
7
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/wishlist-items/",
8
CURLOPT_RETURNTRANSFER => true,
9
CURLOPT_ENCODING => "",
10
CURLOPT_MAXREDIRS => 10,
11
CURLOPT_TIMEOUT => 30,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "GET",
14
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--",
15
CURLOPT_HTTPHEADER => array(
16
"apikey: <apikey>",
17
"authorization: Bearer <access-token>",
18
"content-type: multipart/form-data;",
19
),
20
));
21
​
22
$response = curl_exec($curl);
23
$err = curl_error($curl);
24
​
25
curl_close($curl);
26
​
27
if ($err) {
28
echo "cURL Error #:" . $err;
29
} else {
30
echo $response;
31
}
Copied!

Add to wishlist

post
https://<domain>/<api prefix>/<version>/commerce/wishlist-add/

Sample Code

Node

1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://<domain>/<api prefix>/<version>/commerce/wishlist-add/',
5
'headers': {
6
'apikey': '<api key>',
7
'Authorization': 'Bearer <access-token>',
8
},
9
formData: {
10
'product_id': '<product_id>'
11
}
12
};
13
request(options, function (error, response) {
14
if (error) throw new Error(error);
15
console.log(response.body);
16
});
Copied!

PHP

1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/wishlist-add/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS => array('product_id' => '<product_id>'),
15
CURLOPT_HTTPHEADER => array(
16
'apikey: <api key>',
17
'Authorization: Bearer <access-token>',
18
),
19
));
20
​
21
$response = curl_exec($curl);
22
​
23
curl_close($curl);
24
echo $response;
25
​
Copied!

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/

Sample code

Node

1
var request = require("request");
2
​
3
var options = { method: 'POST',
4
url: 'https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/',
5
headers:
6
{ authorization: 'Bearer <access-token>',
7
apikey: '<apikey>',
8
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' },
9
formData: { product_id: '<product_id>' } };
10
​
11
request(options, function (error, response, body) {
12
if (error) throw new Error(error);
13
​
14
console.log(body);
15
});
Copied!

PHP

1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_PORT => "8000",
7
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/",
8
CURLOPT_RETURNTRANSFER => true,
9
CURLOPT_ENCODING => "",
10
CURLOPT_MAXREDIRS => 10,
11
CURLOPT_TIMEOUT => 30,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "POST",
14
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"product_id\"\r\n\r\n<product_id>\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
15
CURLOPT_HTTPHEADER => array(
16
"apikey: <apikey>",
17
"authorization: Bearer <access-token>",
18
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
19
),
20
));
21
​
22
$response = curl_exec($curl);
23
$err = curl_error($curl);
24
​
25
curl_close($curl);
26
​
27
if ($err) {
28
echo "cURL Error #:" . $err;
29
} else {
30
echo $response;
31
}
Copied!

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
​
Last modified 2mo ago