Follow

Create Subscription and Send to Subscriber in List

The Create Subscription and Send to Subscriber in List command allows you to subscribe an email address to a list and send a single transactional style message to the subscriber.  

These messages are individually created and sent but can be tracked together as a sticky campaign to collect data as a single campaign.   To group your data into a single campaign, use a List with Sticky Campaigns enabled. 

This command does not support the same features as the HTTP API, FTP API, or WebServices API Send commands, including the ability to define Google Analytics strings, Account Profile, Subscriber Data for personalization, or Campaign Name.  If your Template includes Subscriber or Custom Data, you must create the subscriber first and import the data you wish to fill the Template before using this command.  

 

POST /lists

https://[siteurl]/rest/lists/[listId]/[templateId]?querystring

The following queries are supported:

format=[1,2,99], where 1=plain text (default), 2=html, and 99=MIME
duplicates=[0,1], where 0=Do not search for duplicate subscriber, default; 1=Use first matched subscriber  

Request Body Parameters

The Create Subscription and Send to Subscriber in List command requires the URI call with the List ID and Template ID. Optional Filters include Format and Duplicates parameters. 

The query strings 'format' and 'duplicates' are case sensitive and must be defined as in the example above.  If the query string is incorrect or missing, it is ignored and the command creates a Plain Text message without duplication, sending to the first subscriber found to match the posted JSON.

The command also requires the following in the Posted JSON:

  • Subscriber ID: "subscriberId": [subscriberId], Required an integer > 0
  • Email: "email": [email], Optional
  • First Name: "firstName": [firstName] , Optional

To send to a Subscriber in a Customer Key enabled Account, you must also include the Customer Key in the JSON: 

  • Customer Key: "customerKey": [customerKey]

Request Body Example

Using Create Subscription and Send to Subscriber in List with all arguments, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/lists/13/42?format=99&duplicates=0' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "subscriberId": 716094, "email": "jon.doe@mydomain.com" }' \
--include

Using Create Subscription and Send to Subscriber in List in a Customer Key enabled account, line breaks in JSON for readability:

curl --request POST \ 
--url 'https://mail.mydomain.com/rest/lists/13/2?format=99&duplicates=0' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--data '{ "subscriberId": 716094, "email": "jon.doe@mydomain.com", "firstName": "Jon",
"customerKey": "jDoe3214" }' \
--include

Response Body

The response returns a Success or Failure Error.  Based on the first example above, the response returns a 0 for Success:

HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Content-Length: 1
Date: Fri, 17 Mar 2018 12:54:44 GMT
0

Error Response

Error Response Codes include both Client Errors (4xx) and Server Errors (5xx).  Descriptions of each can be found in Response Codes.  An error will occur if List ID or Template ID are not found, if a Subscriber ID or Email/Customer Key is not supplied in the JSON, or if Subscriber is not found.

For example, if a Subscription does not exist for the Subscriber, the error would appear as:

{
"error": "Subscriber Not Found"
"status": "Not Found"
"statusCode": 404
}

Feature added in v12.17.0

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk