Fetch User Lists

Fetches all of the lists owned by the logged in shopper without the list contents.


Fetches all List owned by the logged-in shopper without the list contents using Javascript APIs


swat.wishlist.fetchUserLists(onSuccess, onError)


Here's an example demonstrating how to use this API to get all the Lists owned by the logged-in shopper:

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

// Define error callback  
let onError = function(error) {  
  console.log("Error while fetching user lists", error);  

// Fetch the user lists of the shopper  
swat.wishlist.fetchUserLists(onSuccess, onError);

API Parameters

onSuccessfunctionCalled when all the Lists are successfully fetched.
onErrorfunctionCalled when there is an error while fetching all the Lists.

Success Response

The success response contains an array of Lists owned by the shopper. Each List has information like its name, type, lid, created timestamp (cts), and other useful metadata.

This information can be used to retrieve or manipulate the Lists in future API calls.

    // status of the api call as success or error
    "status": "success",
    "data": [
            // Unique identifier for the device.
            "di": "96f35dcb-699d-46ca-ad09-6f9503ca3275",
            // Type of the list (in this case, "wl" means it is a wishlist)
            "lty": "wl",
            // Unique identifier for the shopper.
            "uid": "k6EjhHmacSbNDQW/9ZM24umd2pV5VLUDe44sNcfSunM=",
            // Timestamp of when the list was created
            "cts": 1692122947783,
            // Name of the list
            "lname": "My Wishlist",
            // User who created the list
            "cby": "[email protected]",
            // Unique identifier for the list
            "lid": "1e086691-b88a-48df-9cac-fa7da8c57827",
            // Unique merchant Id
            "pid": "jID7uqlAM3iF/xqAmtL8eFr0kC7nvE/NDXyrLxZ1Y6E=",
            "st": 1,
            "id": "965d94ac-6927-40ea-9d94-ac692730ea9a",
            "uts": 1692122947783,
            "_pkey": "k6EjhHma",
            "_t": 1,
            // User email id of the list.
            "uby": "[email protected]",
            "lhash": "bXktd2lzaGxpc3Q=",
            // User for whom the list was created
            "cfor": "[email protected]"

Other References

List Fields

  "lid": "swym generated list ID",
  "lname": "List name. List names need not be unique, i.e. If uniqueness is needed API caller should ensure dupes are not",
  "lty": "_recommends", //To prevent mixing with enduser created wishlists
  "lnote": "Optional. List note, single line of note at the list level",
  "lprops": {}, //Optional. Map or properties - {}. Not available downstream for reporting or segmentation queries
  "anonRead": "Optional. Default - false. Boolean flag if anonymous read is allowed for the given List ID",
  "_cp": false,
  "cby": "Created by email address",
  "uby": "Updated by email address",
  "cts": "Created at in milliseconds",
  "uts": "Updated at in milliseconds",
lidstringYesList id to identify the list uniquely.
lnamestringYesList name.
ltystring(optional)List type - when null, it represents wishlist. When set to a value eg: _saveForLater, gets added to a different type of list separate from the wishlist
lnotestring(optional)Optional note
lpropsobject(optional)Optional. Map of custom fields
anonReadboolean(optional)Optional. True if the list can be read anonymously with lid
_cpboolean(optional)Optional. True if list duplication is in progress, copying the list items for large lists
ctsnumber(optional)Created time at in milliseconds
utsnumber(optional)Last updated time at in milliseconds
cbystring(optional)Email address of the user if known when list was created
ubystring(optional)Email address of the user if known when list was last updated