Fetch Saved Cart Products [Beta]
Fetch Products that have been saved to cart by shopper
Contact support for using Beta Shopper APIs.
Introduction
This API retrieves the products that are saved to their cart by a shopper. For logged-in shoppers, all products saved to their cart are retrieved, while for non-logged-in shoppers, all products saved to the cart in their session on the device are retrieved. By default, the API returns a maximum of 12 latest products that are saved to the cart.
Endpoint
Endpoint | request type | API Type |
---|---|---|
https://{{Swym API Endpoint}}/api/v3/shopper/fetch-saved-cart-products | POST | shopper |
Query Params
Parameter | Type | Required | Description |
---|---|---|---|
pid | string (Encoded) | Yes | Unique identifier for the store available in Swym Admin |
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 |
Example Curl
curl --location '{{Swym API Endpoint}}/api/v3/shopper/fetch-saved-cart-products?pid={{URL Encoded PID}}' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'regid={{regid}}' \
--data-urlencode 'sessionid={{sessionid}}'
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. |
Success Response
{
"savedCart": [
{
// Product ID from the Platform
"productId": 7096231231686,
// Timestamp at which the product was added to cart
"lastSavedTime": 1709013095458,
// Varaint ID form the Platform
"variantId": 41254655393990,
// Produc URL
"productURL": "https://demo.swym.it/products/ceramic-oval-basin",
// Timestamp of the latest order placed with the product after it was added to cart
"lastOrderTimestamp": 1708426159001,
// ID of the variant that was ordered after the product was added to cart
"lastOrderedVariantId": 41254655393990,
// ID of the latest order placed with the product after it was added to cart
"lastOrderId": 2849832
}
]
}
Error Response:
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. |
Updated 9 months ago