Fetch Subscriptions [BETA]
Fetch all subscriptions of a Shopper
Contact support for using Fetch Subscriptions Beta APIs.
This document describes the API for getting a list of subscriptions of a shopper
Endpoint | request type | API Type |
---|---|---|
https://{{Swym API Endpoint }}/api/v3/subscriptions/fetch-subs | POST | shopper |
Query Params
Parameter | Type | Required | Description |
---|---|---|---|
pid | string (Encoded) | Yes | Unique identifier for the store available in Swym Admin |
Header Params
Parameter | Type | Required | Description |
---|---|---|---|
user-agent | string | Yes | User-Agent header of the app used to access the API |
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 |
topic | string | Yes | Read more about topics |
medium | string | No | medium (email, sms) |
limit | integer | No | Limit on number of records to be returned - it is defaulted to 10 |
offset | integer | No | Offset from which the records are fetched - it is defaulted to 0 |
curl -X POST \ 'https://{{Swym API Endpoint}}/api/v3/subscriptions/fetch-subs?pid={{URL Encoded PID}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'user-agent: {{user-agent}}' \
-d 'regid={{regid}}&sessionid={{sessionid}}&topic=backinstock'
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. |
{{user-agent}} | This needs to be replaced with User-Agent header value. |
Success Response
Note
In the list of subscriptions in response
mediumvalue
,cby
anduby
will be REDACTED (has valueXXXXXX
) in case the shopper is not logged in
The below responses are what you would get based on being logged in or an authenticated user.
{
// Limit
"limit": 10,
// Offset
"offset": 0,
// Total number of records that is available for this shopper
"total": 1,
"subscriptions": [
{
// Medium that the shopper subscribed to
"medium": "email",
// Title of the product that the shopper subscribed to
"dt": "Ceramic Oval Basin",
// Created Timestamp
"cts": 1713410738844,
// Topic to which the shopper subscribed to
"topic": "backinstock",
// Product ID of the product to which the shopper subscribed to
"empi": 7096231231686,
// created by - This will be available when this was manually created by someone else other than merchant
// This will be available(not redacted) if the shopper is logged in
"cby": "",
// Product URL
"du": "https://demo.swym.it/products/ceramic-oval-basin",
// Unique identifier for the store
"pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
// Variant ID of the product to which the shopper subscribed to
"epi": 41254655393990,
// Status of the subscription 0 when not sent, 1 when sent and 2 when processing
"status": 0,
// Medium value with which the shopper subscribed
// This will be available(not redacted) if the shopper is logged in
"mediumvalue": "[email protected]",
// Updated Timestamp
"uts": 1713410738844,
// Image URL of the product to which the shopper subscribed
"iu": "https://demo.swym.it/cdn/shop/products/[email protected]?v=1637582881",
// updated by - This will be available when this was manually updated by someone else other than merchant
// This will be available(not redacted) if the shopper is logged in
"uby": "",
// Price of the product to which the shopper subscribed
"pr": 300,
// Category of the product to which the shopper subscribed
"ct": "",
// Variant title of the variant to which the shopper subscribed
"vi": "Default Title"
}
]
}
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. |
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 about 2 months ago