Email a wishlist

Send wishlist contents via email by using Swym as an email service provider.

Introduction

Sends an email with a public list via swym to an end user.Swym sends the contents of a shared wishlist to the recipient's email address. The sender's regid is required along with the email address of the recipient.

🚧

Authenticated users only. Implementations that need to support this need to build out logic only for logged-in users where the source email is clear.

Endpoint

Endpointrequest typeAPI Type
{{Swym API Endpoint }}/api/v3/lists/emailListPOSTshopper

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.
fromnamestringYesSharer’s from name string
toemailstringYesvalid email address of the recipient

Example Curl

An example of a /api/v3/lists/markPublic request with lid

curl --location --request POST '{{Swym API Endpoint}}/api/v3/lists/emailList?pid={{Url Encoded PID}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--data-urlencode 'regid={{regid}}' \
--data-urlencode 'sessionid={{sessionid}}' \
--data-urlencode 'lid={{lid}}' \
--data-urlencode 'toemail={{to email}}' \
--data-urlencode 'fromname={{from name}}'
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
  'regid': '434exmh4BYrhN7PjlhoenPg_xTCNIZbePTmnLlcsn08WUHePo3dW982441ry1xqumzRKXMzbES9S4zMX2kKDvyf1iXMSyA1sF1U2nR7NOL1hrBFSj5AFk14_ZxfUYoyGAKufBh2BGRss9NGX4iOJqX73NP5frO5Wh94ZI5RmMTwxTv3VbF2XukZ8fk6QfcrR16i1IEUAuc-FbLSgc_pev4WEVkchaw74ifMEgly_sVc',
  'sessionid': 'cbf82002-7724-4702-b4cb-f53cd6a91018-API',
  'lid': '671de5eb-e69f-4b25-8ab7-0b9cd245f27a',
  'toemail': '[email protected]',
  'fromname': 'My Name' 
});
var config = {
  method: 'post',
  url: '{{Swym API Endpoint}}/api/v3/lists/emailList?pid=HrR2aHVe2DNffJdNtPgRnrJIQku44Cyyl9QWqL24%2FXE%3D',
  headers: { 
    'Content-Type': 'application/x-www-form-urlencoded', 
    'Accept': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

🚧

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.
{{toemail}}This needs to be replaced with the actual recipient email address.
{{fromname}}This needs to be replaced with the actual from name of the sender.

Success Response

When the list is marked public, the entire list contents are returned, this allows anyone with the lid to view the list.

{
    "listinfo": {
        "di": "5bd7121b-557b-4931-afc8-dadd0b68b2b6",
        "listcontents": [
            {
                "di": "5bd7121b-557b-4931-afc8-dadd0b68b2b6",
                "bt": "Rossignol",
                "uid": "ny2AXQ5m7rQ7sRsaTmXvvafMGCKfwTbZY/5eZ3FTH+w=",
                "dt": "12 Ti Xelium Skis",
                "cts": 1664192520830,
                "empi": 7760870834388,
                "cby": "[email protected]",
                "lid": "671de5eb-e69f-4b25-8ab7-0b9cd245f27a",
                "du": "https://karthikeyantesting.myshopify.com/products/rossignol-pursuit-12-ti-xelium-mens-skis-xel-110-b73-bindings-2015?variant=43281165648084",
                "pid": "HrR2aHVe2DNffJdNtPgRnrJIQku44Cyyl9QWqL24/XE=",
                "epi": 43281165648084,
                "id": "63ac7809-5add-4673-ac78-095add667367",
                "uts": 1664192520830,
                "_pkey": "ny2AXQ5m",
                "iu": "https://cdn.shopify.com/s/files/1/0631/5157/1156/products/Untitled-1_copy_copy_copy_copy_copy_620x620.jpg?v=1663312896",
                "_t": 2,
                "uby": null,
                "pr": 300.0,
                "vi": "163cm"
            }
        ],
        "userinfo": {
            "sw_mkt": null,
            "uid": "ny2AXQ5m7rQ7sRsaTmXvvafMGCKfwTbZY/5eZ3FTH+w=",
            "em": "[email protected]",
            "cts": 1664193439779,
            "pid": "HrR2aHVe2DNffJdNtPgRnrJIQku44Cyyl9QWqL24/XE=",
            "uts": 1664193439779,
            "acc_mkt": null,
            "ut": null,
            "prefs": null
        },
        "lty": "wl",
        "uid": "ny2AXQ5m7rQ7sRsaTmXvvafMGCKfwTbZY/5eZ3FTH+w=",
        "cts": 1664191839275,
        "anonRead": 1,
        "cnt": 1,
        "lname": "Guest List",
        "cby": "[email protected]",
        "lid": "671de5eb-e69f-4b25-8ab7-0b9cd245f27a",
        "pid": "HrR2aHVe2DNffJdNtPgRnrJIQku44Cyyl9QWqL24/XE=",
        "st": 1,
        "id": "9f7d2b14-636d-441e-bd2b-14636da41e88",
        "uts": 1665392300428,
        "_pkey": "ny2AXQ5m",
        "_t": 1,
        "itemcmnts": 0,
        "uby": "[email protected]",
        "lhash": "Z3Vlc3QtbGlzdA=="
    },
    "msg": "List emailed successfully."
}

👍

When the status code is 200,the recipients email address will receivee an email from Swym with the shared list contents.

This email template can be edited in some special cases; please reach out to [email protected].

Error Response:

In the event that the list is invalid or not created, it can throw an error such as

{
    "error": true,
    "msg": "List Not Found",
    "type": "sw-entity-notfound",
    "uid": "ny2AXQ5m7rQ7sRsaTmXvvafMGCKfwTbZY/5eZ3FTH+w=",
    "di": "c0deab58-8510-4aa2-9a1a-328812c8e0a1-API",
    "lid": "671de5eb-e69f-4b25-8ab7-0b9cd245f27"
}
{
    "msg": "Invalid Email"
}

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.