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

Endpointrequest typeAPI Type
https://{{Swym API Endpoint }}/api/v3/subscriptions/fetch-subsPOSTshopper

Query Params

ParameterTypeRequiredDescription
pidstring (Encoded)YesUnique identifier for the store available in Swym Admin

Header Params

ParameterTypeRequiredDescription
user-agentstringYesUser-Agent header of the app used to access the API

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
topicstringYesRead more about topics
mediumstringNomedium (email, sms)
limitintegerNoLimit on number of records to be returned - it is defaulted to 10
offsetintegerNoOffset from which the records are fetched - it is defaulted to 0
curl -X POST \ 
  --header 'Content-Type: application/x-www-form-urlencoded' \
 	--header 'Accept: application/json' \
  --header 'user-agent: {{user-agent}}' \
  -d 'regid={{regid}}&sessionid={{sessionid}}&topic=backinstock' \
	'https://{{Swym API Endpoint}}/api/v3/subscriptions/fetch-subs?pid={{URL Encoded PID}}'

🚧

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.
{{user-agent}}This needs to be replaced with User-Agent header value.

Success Response

📘

Note

In the list of subscriptions in response mediumvalue, cby and uby will be REDACTED (has value XXXXXX) 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 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.
500Internal Server ErrorWe had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.