Fetch Paginated List

Fetches the paginated list contents in a list owned by a logged in shopper.

swat.wishlist.fetchPaginatedList

Returns an array of paginated List Contents (products) for the List with a given listData.

Used to fetch the paginated List Contents present in a given List.

Definition

swat.wishlist.fetchPaginatedList(listData, onSuccess, onError)

Example

Here's an example of how you can use this API to fetch the paginated List Contents of a List called My Wishlist:

// Define the listData object  
let listData = {  
  sortby: "price", // column name to sort the list items
  sortorder: "asc", // sort order to sort the list items
  filterby: "outofstock", // filter condition to filter list items
  lid: "0116e283-ed9a-4685-adf1-68eea1751f62", // lid
  itemslimit: 60, // limit of items returned in one page
  next: "idnVDP9ygHcFgmReBhsE5afJQ0Q-2nxI_puRMqptxdJld5Nha74urvqgx1B1AijiRU9bACEo2cA1Rct1MQvUxczkUSfVKJeF9NeuUS5uAo-WnPLAVmd07my5s4xlh7JPX2d_8akl6PS_mdfdVBQh8YX2crfRTtN3NOqPNrvTTDsODRvUn3CUW9vWqZNmq5OGzQcllC0omfa7vBCb9Byiq-64s5ZjYdqJHyeYSrOCK2a4l2jLVxdKAbfFaj6E7oJy"
  // next token to fetch the next page. The next token will be null in the first request
};

// Define success callback  
let onSuccess = function(data) {  
  // Executed when a paginated list data is successfully fetched  
  console.log("Successfully fetched paginated list data of the shopper: ", data);  
}

// Define error callback  
let onError = function(error) {  
  console.log("Error while fetching paginated list data", error);  
}

// Fetch the paginated list data of the shopper
swat.wishlist.fetchPaginatedList(listData, onSuccess, onError);

📘

Sort and Filter

Please note that sort and filter are not enabled by default and are only available for the Enterprise plan. If you need to sort and filter, please contact the support team to enable it.

API Parameters

ArgumentTypeDescription
listDataobjectData about the list which may include lid, sortby, sortorder, filterby, itemslimit and next.
onSuccessfunctionCalled when the List Contents are successfully fetched.
onErrorfunctionCalled when there is an error while fetching the List Contents.

Success Response

The success response contains an array of List Contents present in the given List and the next token in the pagination object. Each List Item has information like its empi, epi, quantity etc.

{
    "status": "success",
    "data": {
        "di": "96f35dcb-699d-46ca-ad09-6f9503ca3275",
        "listcontents": [
            {
                "di": "96f35dcb-699d-46ca-ad09-6f9503ca3275",
                "uid": "k6EjhHmacSbNDQW/9ZM24umd2pV5VLUDe44sNcfSunM=",
                "dt": "Axium 100 B83",
                "cts": 1692122982864,
                "empi": 8571187331353,
                "cby": "[email protected]",
                "lid": "1e086691-b88a-48df-9cac-fa7da8c57827",
                "du": "https://swym-ent-test-store.myshopify.com/products/rossignol-axium-100-b83",
                "pid": "jID7uqlAM3iF/xqAmtL8eFr0kC7nvE/NDXyrLxZ1Y6E=",
                "epi": 46323696369945,
                "id": "974a0281-6ba0-4562-8a02-816ba0b56273",
                "uts": 1692122982864,
                "_pkey": "k6EjhHma",
                "iu": "https://swym-ent-test-store.myshopify.com/cdn/shop/products/rossignol_RCDA029_AXIUM-100-B83-BLACK-WHITE_620x620.jpg?v=1692122914",
                "_t": 2,
                "uby": "[email protected]",
                "pr": 110,
                "ct": "Ski Bindings",
                "vi": "B83 Black/White"
            }
        ],
        "lty": "wl",
        "uid": "k6EjhHmacSbNDQW/9ZM24umd2pV5VLUDe44sNcfSunM=",
        "cts": 1692122947783,
        "lname": "My Wishlist",
        "cby": "[email protected]",
        "lid": "1e086691-b88a-48df-9cac-fa7da8c57827",
        "pid": "jID7uqlAM3iF/xqAmtL8eFr0kC7nvE/NDXyrLxZ1Y6E=",
        "st": 1,
        "id": "965d94ac-6927-40ea-9d94-ac692730ea9a",
        "uts": 1692122947783,
        "_pkey": "k6EjhHma",
        "_t": 1,
        "uby": "[email protected]",
        "lhash": "bXktd2lzaGxpc3Q=",
        "cfor": "[email protected]"
    },
    "pagination": {
        "next": "4VmfPRKJ_Ag9zCAWRLL9bYXi1ZFMe33oNkdkDDGvSJ_CzHbLTl4wWSl6wVttEk7b5MJ_oiKd8Yh6Q1CNzODvurorzhwh2-G4_57WCNNdbrmewWz-N_KejfYAa755pG2aDYDaH35gR2lqfKjBwl3HOJ7bFvkyOuDz-hcZl41rOc4b_anzI7Crf59BoU8facfJ"
    }
}

Other References

List Data

{  
  "sortby": "price", // column name to sort the list items
  "sortorder": "asc", // sort order to sort the list items
  "filterby": "outofstock", // filter condition to filter list items
  "lid": "0116e283-ed9a-4685-adf1-68eea1751f62", // lid
  "itemslimit": 60, // limit of items returned in one page
  "next": "idnVDP9ygHcFgmReBhsE5afJQ0Q-2nxI_puRMqptxdJld5Nha74urvqgx1B1AijiRU9bACEo2cA1Rct1MQvUxczkUSfVKJeF9NeuUS5uAo-WnPLAVmd07my5s4xlh7JPX2d_8akl6PS_mdfdVBQh8YX2crfRTtN3NOqPNrvTTDsODRvUn3CUW9vWqZNmq5OGzQcllC0omfa7vBCb9Byiq-64s5ZjYdqJHyeYSrOCK2a4l2jLVxdKAbfFaj6E7oJy"
  // next token to fetch the next page. The next token will be null in the first request
}
ArgumentTyperequired?Description
lidstringYesList id to identify the list uniquely.
sortbystring (price/title)(optional)Disabled by default. Please Contact Support to enable. Column to use for sorting the list contents.
Should be one of price or title. By default, the list is sorted using the time items were added to the list.
sortorderstring (asc/desc)(optional)Disabled by default. Please Contact Support to enable. Sort the list contents in ascending or descending order.
Should be one of asc or desc. By default, the list is sorted in descending order.
filterbystring (instock/outofstock)(optional)Disabled by default. Please Contact Support to enable. Apply filter by conditions to the items.
instock is to fetch items that are currently in stock and outofstock is to fetch items that are currently out of stock.
Should be one of instock or outofstock. By default, no filter by conditions is applied.
itemslimitint(optional)Number of items to be returned in a page. The minimum value is 50 and the Maximum value is 100.
The default value if not passed is 50. To update the default value permanently, please contact support.
nextstring(optional)Next Token for fetching the next page. If not provided, the first page will be fetched. This token is reset if any of the sort or filter params are updated.
The next token to fetch the next page is provided in the response of a successful API call.
If the next token is null, then the list has reached the end and has no next page.