Fetch all products

Fetch the list of products added to the user's Save For Later list.

swat.SaveForLater.fetch

Definition

swat.SaveForLater.fetch(lid, onSuccess, onError)

Example

let lid = "7f69f914-d413-48dc-b449-77e9c3ff08e8";

let onSuccess = function(response) {
	console.log("Successfully Fetched a Save for Later List", response);
}

let onError = function(error) {
	// Error is an xhrObject
	console.log("There was an Error, while we tried to fetch the Save For Later List", error);
}

// Call the Init function.
swat.SaveForLater.fetch(lid, onSuccess, onError);

API Parameters

ArgumentTypeDescription
lidstringlist id of the save for later list.
onSuccessfunctionCalled when the Save for Later List is successfully fetched.
onErrorfunctionCalled when there is an error while fetching the Save for Later List.

Response

{
    "list": {
        "di": "fb283019-487b-4447-99e6-133178f6477e",
        "lty": "sfl",
        "uid": "8kPqqX6/sOYTTOc0WqrpkhmWttqouvi3wygUngPfiHU=",
        "cts": 1679667114911,
        "lnote": null,
        "lname": "My SFL List",
        "cby": "[email protected]",
        "lid": "7f69f914-d413-48dc-b449-77e9c3ff08e8",
        "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
        "st": 1,
        "cprops": {},
        "id": "ba3b87ac-715e-4b9c-bb87-ac715efb9cb0",
        "uts": 1679667114911,
        "ldesc": {},
        "uby": null,
        "cfor": null
    },
    "items": [],
    "userinfo": {
        "fname": "first name",
        "uid": "8kPqqX6/sOYTTOc0WqrpkhmWttqouvi3wygUngPfiHU=",
        "m": null,
        "em": "[email protected]",
        "cts": 1652286963869,
        "lname": "last_name",
        "pid": "/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
        "uts": 1674475641105
    },
    "pagination": {
        "totalcount": 0,
        "next": null,
        "limit": null
    }
}

This information can be used to retrieve or manipulate the Save for Later and List Items in future API calls.

Response Reference

Key NameDescriptions
listList Information on Save for Later List
itemsContains all the items for this user, initially it will be empty.
userinfocontains information on the user.
paginationpagination.

Other References.

List

A simple Javascript object containing parameters required for creating a new List

Property NameData TypeRequiredDescription
lnamestringYesList name - unique for a given user, allows 3-50 characters.
ltystringYesSpecifies the type of list you want to create, wl - wishlist, sfl - save for later, this is used to create a different type of list separate from the wishlist`
fromlidguid stringoptionalUsed to duplicate a list, when supplied this lid would be used to duplicate from
lnotestringoptionalNote you may add to list, that you can fetch at a later time for frontend use
lpropsobjectoptionalCustom object that can store attrbiutes of your choice for each list.

Item

Property NameData TypeRequiredDescription
epiint/stringYesVariant id of the product to be added
empiint/stringYesProduct id of the product to be added
dustringYesCanonical uri of the product to be added
qtyintoptionalDefaults to 1. Quantity included for the add action
notestringoptionalOptional note
cpropsobjectoptionalMap of custom fields
lblsarrayoptionalArray of strings indicating labels, rooms, etc. for HTC. Only one value supported in array. eg: ["Room1"]
_avbooloptionaltrue if the list action was done without user explicitly picking a variant. Can be used by Wishlist UX to require user to pick variant before adding to cart