Update List Attributes

Update List level attributes such as note, name, and custom properties.

swat.updateList

Updates the List Attributes such as a note, name, and custom properties for a List with the given lid. Returns the updated list object.

🚧

This API does not update list contents or products

Definition

swat.updateList(listUpdateConfig, onSuccess, onError)

Example

Here is an example demonstrating how to use this API to update a List named black friday list by adding a new note:

// Define the list update config
var listUpdateConfig = {
  "lid": "59179e9f-139d-4857-bcdd-3ad88a38b47d",
  "lnote": "I am being updated..yay!"
};
// Update lprops - custom properties for frontend use only - optional
// listUpdateConfig.lprops = {customVal1: "custom value"};

// Define success callback
let onSuccess = function(updatedListObj) { 
  // Executed when list is successfully updated
  console.log("Successfully updated the List", updatedListObj);
}

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

// Update the list with the above callbacks and listUpdateMap
swat.updateList(listUpdateConfig, onSuccess, onError);

API Parameters

ArgumentTypeDescription
listUpdateConfigobjectPlease refer List Update Input
onSuccessfunctionCalled when the List is successfully updated.
onErrorfunctionCalled when there is an error while updating the List.

Success Response

The success response provides details about the updated List, including its lname, type, lid, created timestamp, as well as other valuable metadata.

You can utilize this information for future API calls to retrieve or modify the List.

{
   // Unique identifier for the item, also used as a foreign key for the list
   "di": "e502694b-8f26-4ab3-ae35-bafd7c8eed95",
   // List of items in the list
   "listcontents": [
     {
       // Unique identifier for the item, also used as a foreign key for the list
       "di": "e502694b-8f26-4ab3-ae35-bafd7c8eed95",
       // Name of the item
       "bt": "Swym Marketing",
       // Description of the item
       "dt": "12 Inches Round Rose Gold Frame Wall Mirror",
       // Timestamp of when the item was added to the list
       "cts": 1679469250932,
       // Unique identifier for the user who added the item
       "empi": 7096437407942,
       // Stock Keeping Unit (SKU) of the item
       "sku": "45",
       // Unique identifier for the list that the item belongs to
       "lid": "a5decd55-5bfe-4cd4-9991-ed5721ae2914",
       // URL of the item's page on the website
       "du": "https://demo.swym.it/products/12-inches-round-rose-gold-frame-wall-mirror?variant=41255230701766",
       // Hashed product ID of the item
       "pid": "/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
       // Variant ID of the item
       "epi": 41255230701766,
       // Unique identifier for the item
       "id": "902d434b-92c5-445a-ad43-4b92c5245adb",
       // Timestamp of when the item was last updated
       "uts": 1679469250932,
       // URL of the item's image
       "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/12InchesRoundRoseGoldFrameWallMirror_620x620.jpg?v=1637593774",
       "_t": 2, // _t is for Internal usage - ignore.
       // User who last modified the item
       "uby": null,
       // Price of the item
       "pr": 200.0
     }
   ],
   // Information about the user who created the list
   "userinfo": null,
   // Type of the list (in this case, "wl" means it is a wishlist)
   "lty": "wl",
   // Timestamp of when the list was created
   "cts": 1679469250670,
   // Number of items in the list
   "cnt": 1,
   // Name of the list
   "lname": "my black friday list",
   // User who created the list
   "cby": null,
   // Unique identifier for the list
   "lid": "a5decd55-5bfe-4cd4-9991-ed5721ae2914",
   // unique merchant ID
   "pid": "KABSbuGyYCuM6/IV7e7cGxT1978Lie"
}

Other References

List Update Input

Updates can be made to various fields in the list, as detailed below.

var listUpdateConfig = {
  "lid": "list Id",
  "lname": "List name",
  "lnote": "List note",
  "lprops": {}
};
--data-urlencode 'lid={{lid}}' \
--data-urlencode 'lname={{lname}}' \
--data-urlencode 'lnote={{lnote}}' \
--data-urlencode 'lprops={{JSON stringified lprops}}' \
ArgumentTypeRequiredDescription
listUpdateConfig.lidstringYesUnique id of the List to be updated
listUpdateConfig.lnotestringoptionalList note
listUpdateConfig.lpropsobjectoptionalMap of custom fields

🚧

List names are unique for a given shopper and cannot be updated