Whishlist

Manage wishlist

Get wishlist items

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

get the list of items in wishlist

Query Parameters

Headers

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

Headers

Request Body

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

Remove item from the wishlist

POST https://<domain>/<api prefix>/<version>/commerce/wishlist-remove/

remove a specific item from wishlist

Headers

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

Last updated