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.
a
- Adding to a list: Enhance the list by including new products.u
- Updating a list: Modify the products in the list as needed.d
- Deleting: Revise the list by removing products from the list.
Endpoint
Endpoint | request type | API Type |
---|---|---|
https://{{Swym API Endpoint }}/api/v3/lists/update-ctx | POST | shopper |
Headers
Parameter / field | Description | content-type | required |
---|---|---|---|
user-agent | a string to identify user agent that is requesting the List update | string | Yes |
Query Params
Parameter | Type | Required | Description |
---|---|---|---|
pid | string (Encoded) | Yes | Unique identifier for the store available in Swym Admin |
limit | int64 | No | Maximum number of records to return |
offset | int64 | No | Number of records to skip |
Form Data
Field | Type | Required | Description |
---|---|---|---|
regid | string | Yes | Unique identifier for the shopper generated by generate-regid |
sessionid | string | Yes | Session id generated with generate-regId endpoint which does not expire without manual intervention |
lid | string | Yes | Unique identifier of the list. |
a | Array of list items | N/A | Array of products to add to the list. |
u | Array of list items | N/A | Array of products to update on the list. |
d | Array of list items | N/A | Array 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.
Placeholders | Descriptions |
---|---|
{{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 Code | Type | Description |
---|---|---|
400 | Bad Request | Your request is invalid, change your request params and query and try again. |
401 | Unauthorised | You 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. |
403 | Forbidden | You are not allowed to request this data. |
404 | Not Found | The specified requested data could not be found. |
429 | Too Many Requests | You're raising too many requests! Slow down! |
500 | Internal Server Error -- | We had a problem with our server. Try again later. |
503 | Service Unavailable | We're temporarily offline for maintenance. Please try again later. |
Product
An object containing params required for creating, updating or deleting list items
Property Name | Data Type | Required | Description |
---|---|---|---|
epi | int/string | Yes | Variant id of the product to be added |
empi | int/string | Yes | Product id of the product to be added |
du | string | Yes | Canonical uri of the product to be added |
qty | int | optional | Defaults to 1. Quantity included for the add action |
note | string | optional | Optional note |
cprops | object | optional | Map of custom fields |
lbls | array | optional | Array of strings indicating labels, rooms, etc. for HTC. Only one value supported in array. eg: ["Room1"] |
Updated over 1 year ago