Manage products in a list

Add, Update, or Delete products in a list.

List Operations

This section focuses on managing a shopper's list. You can perform the below actions for each of the encoded parameters for a single lid.

  1. a - Adding to a list: Enhance the list by including new products.
  2. u - Updating a list: Modify the products in the list as needed.
  3. d - Deleting: Revise the list by removing products from the list.

Endpoint

Endpointrequest typeAPI Type
https://{{Swym API Endpoint }}/api/v3/lists/update-ctxPOSTshopper

Headers

Parameter / fieldDescriptioncontent-typerequired
user-agenta string to identify user agent that is requesting the List updatestringYes

Query Params

ParameterTypeRequiredDescription
pidstring (Encoded)YesUnique identifier for the store available in Swym Admin
limitint64NoMaximum number of records to return
offsetint64NoNumber of records to skip

Form Data

FieldTypeRequiredDescription
regidstringYesUnique identifier for the shopper generated by generate-regid
sessionidstringYesSession id generated with generate-regId endpoint which does not expire without manual intervention
lidstringYesUnique identifier of the list.
aArray of list itemsN/AArray of products to add to the list.
uArray of list itemsN/AArray of products to update on the list.
dArray of list itemsN/AArray of products to delete in the list.

Example Curl


curl -X POST '{{Swym API Endpoint}}/api/v3/lists/update-ctx?pid={{URL Encoded PID}}' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --header 'Accept: application/json' \
     --header 'user-agent: mobileApp' \
     --data-urlencode 'regid={{regid}}' \
     --data-urlencode 'sessionid={{sessionid}}' \
     --data-urlencode 'lid={{lid}}' \
     --data-urlencode 'a=[{"epi":41450466377888,"empi":7168987889824,"du":"https://yourstore.myshopify.com/products/blue-silk-tuxedo"}]'



curl -X POST '{{Swym API Endpoint}}/api/v3/lists/update-ctx?pid={{Url Encoded PID}}' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --header 'Accept: application/json' \
     --header 'user-agent: mobileApp' \
     --data-urlencode 'regid={{regid}}' \
     --data-urlencode 'sessionid={{sessionid}}' \
     --data-urlencode 'lid={{lid}}' \
     --data-urlencode 'u=[{"epi":41450466377888,"empi":7168987889824,"du":"https://yourstore.myshopify.com/products/blue-silk-tuxedo"}]'



curl -X POST '{{Swym API Endpoint}}/api/v3/lists/update-ctx?pid={{Url Encoded PID}}' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --header 'Accept: application/json' \
     --header 'user-agent: mobileApp' \
     --data-urlencode 'regid={{regid}}' \
     --data-urlencode 'sessionid={{sessionid}}' \
     --data-urlencode 'lid={{lid}}' \
     --data-urlencode 'd=[{"epi":41450466377888,"empi":7168987889824,"du":"https://yourstore.myshopify.com/products/blue-silk-tuxedo"}]'


🚧

Curl Placeholders

Assuming these values are provided above, the curl command should work correctly. However, if there are any issues with the API endpoint or the data being passed in the request, there could still be errors that need to be resolved before you can test these APIS.

PlaceholdersDescriptions
{{Swym API Endpoint}}This needs to be replaced with the actual Swym API endpoint URL.
{{URL Encoded PID}}This needs to be replaced with the actual PID value, URL-encoded.
{{regid}}This needs to be replaced with the actual regid value.
{{sessionid}}This needs to be replaced with the actual session ID value.
{{lid}}This needs to be replaced with the actual list ID value.

Success Response

{
  "a": [
    {
      "di": "155d8f08-abcb-4dcc-afc6-e0add8df1379",
      "bt": "partners-demo",
      "uid": "Xjg/Jbh9Y/0OTIydKNmd5NZjoB7w6B++1/RFflqnPa8=",
      "dt": "Blue Silk Tuxedo",
      "cts": 1682522770502,
      "empi": 7168987889824,
      "cby": "[email protected]",
      "lid": "94dff98c-3eaa-48ee-ad87-98af2f87aeb5",
      "du": "https://yourstore.myshopify.com/products/blue-silk-tuxedo",
      "pid": "/uBEzdkDw3lbo=",
      "epi": 41450466377888,
      "uts": 1682522770502,
      "_pkey": "Xjg/Jbh9",
      "iu": "https://cdn.shopify.com/s/files/1/0590/0723/8304/products/man-adjusts-blue-tuxedo-bowtie_925x_e6ca7031-3707-4ca0-9b1a-cfe7df185ebc_620x620.jpg?v=1638894844",
      "_t": 2,
      "uby": "[email protected]",
      "pr": 70
    }
  ],
  "d": [],
  "u": []
}
{
   "a":[
      
   ],
   "d":[
      {
         "di":"155d8f08-abcb-4dcc-afc6-e0add8df1379",
         "bt":"partners-demo",
         "_attachments":"attachments/",
         "_rid":"bVYdAPMX0vLj7b4AAAAABg==",
         "uid":"Xjg/Jbh9Y/0OTIydKNmd5NZjoB7w6B++1/RFflqnPa8=",
         "dt":"Blue Silk Tuxedo",
         "cts":1682523301898,
         "empi":7168987889824,
         "_ts":1682523301,
         "cby":"[email protected]",
         "_etag":"\"dd011308-0000-0800-0000-644944a50000\"",
         "lid":"94dff98c-3eaa-48ee-ad87-98af2f87aeb5",
         "du":"https://yourstore.myshopify.com/products/blue-silk-tuxedo",
         "pid":"6cLXc3z0TERBWpFvFJUpxjaWITbnZ2/uBEzdkDw3lbo=",
         "epi":41450466377888,
         "id":"54363c50-915a-4b53-b63c-50915a3b5324",
         "uts":1682523301898,
         "_pkey":"Xjg/Jbh9",
         "iu":"https://cdn.shopify.com/s/files/1/0590/0723/8304/products/man-adjusts-blue-tuxedo-bowtie_925x_e6ca7031-3707-4ca0-9b1a-cfe7df185ebc_620x620.jpg?v=1638894844",
         "_t":2,
         "uby":"[email protected]",
         "pr":70
      }
   ],
   "u":[
      
   ]
}
{
   "a":[
      
   ],
   "d":[
      
   ],
   "u":[
      {
         "empi":7168987889824,
         "lid":"94dff98c-3eaa-48ee-ad87-98af2f87aeb5",
         "du":"https://yourstore.myshopify.com/products/blue-silk-tuxedo",
         "pid":"/uBEzdkDw3lbo=",
         "epi":41450466377888,
         "uts":1682523571207,
         "_pkey":"Xjg/Jbh9",
         "_t":2,
         "uby":"[email protected]"
      }
   ]
}
{
    "a": [
        {
            "hasError": true,
            "error": {
                "error": true,
                "msg": "Unknown product",
                "type": "sw-unknown-product",
                "listitem": {
                    "empi": 6693670256663,
                    "du": "https://yourstore.myshopify.com/products/small-hulumanu-black",
                    "epi": 40440734482455
                },
                "event": {
                    "empi": 6693670256663,
                    "du": "https://yourstore.myshopify.com/products/small-hulumanu-black",
                    "epi": 40440734482455
                },
                "pid": "{{Your PID}}",
                "email": "",
                "sessionid": "95797098-8ed7-41b5-a2cd-59eb7023bc70-API"
            },
            "msg": "Unknown product"
        }
    ],
    "d": [],
    "u": []
}

Error Status codes:

If the request is unsuccessful, the API will return a JSON response with an error message and an HTTP status code indicating the type of error that occurred.

Status CodeTypeDescription
400Bad RequestYour request is invalid, change your request params and query and try again.
401UnauthorisedYou are performing an action on a resource that is not granted to the current logged-in user. Additionally, for REST APIs, this could mean your API key is wrong.
403ForbiddenYou are not allowed to request this data.
404Not FoundThe specified requested data could not be found.
429Too Many RequestsYou're raising too many requests! Slow down!
500Internal Server Error --We had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.

Product

An object containing params required for creating, updating or deleting list items

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"]