Fetch List Contents

Fetch only the List Contents.

swat.fetchListCtx

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

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

📘

Things to consider

This API is similar to fetchListDetails but returns only the list items.

Definition

swat.fetchListCtx(listConfig, onSuccess, onError)

Example

Here's an example of how you can use this API to fetch List Contents of a List called black Friday list:

// define the list config
let listConfig = {
  "lid": "59179e9f-139d-4857-bcdd-3ad88a38b47d", // lid
};

// Define success callback
let onSuccess = function(listContents) {
  // successfully fetched list contents
  console.log("Successfully fetched List Contents", listContents);
}

// Define error callback
let onError = function(error) {
  // Error is an xhrObject
  console.log("Error fetching List Contents", error);
}

swat.fetchListCtx(listConfig, onSuccess, onError);

API Parameters

ArgumentTypeDescription
listConfigobjectAn object containing the unique id of the List to fetch its contents.
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. Each List Item has information like its empi, epi, quantity etc.

[
  {
     "bt":"Swym Marketing",
     "cby":null,
     "ct":null,
     "cts":1679598072363,
     "di":"fb283019-487b-4447-99e6-133178f6477e",
     "dt":"12 Inches Round Rose Gold Frame Wall Mirror",
     "du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror",
     "empi":7096437407942,
     "epi":41255230701766,
     "id":"5d054a90-a2b2-4f9d-854a-90a2b2ef9d68",
     "iu":"https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
     "lid":"313bef26-16b4-4861-be1b-c986f6ac5871",
     "pid":"/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
     "pr":200,
     "product":{
        "bt":"Swym Marketing",
        "cby":null,
        "cts":1679598072363,
        "di":"fb283019-487b-4447-99e6-133178f6477e",
        "dt":"12 Inches Round Rose Gold Frame Wall Mirror",
        "du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror?variant=41255230701766",
        "empi":7096437407942,
        "epi":41255230701766,
        "id":"5d054a90-a2b2-4f9d-854a-90a2b2ef9d68",
        "iu":"https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
        "lid":"313bef26-16b4-4861-be1b-c986f6ac5871",
        "pid":"/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
        "pr":200,
        "prodtype":null,
        "sku":"45",
        "title":"12 Inches Round Rose Gold Frame Wall Mirror",
        "uby":null,
        "uri":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror?variant=41255230701766",
        "uts":1679598072363,
        "_pkey":"fb283019",
        "_t":2,
        "raw-du":"https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror"
     }
	}
]