Add a recipient to a recipient list. Double opt-in processes will not be overwritten by other opt-in processes (see <a href="https://support.optimizely.com/hc/en-us/articles/4413192291981#prioritization">Opt-in documentation</a>).
1 min
POST
https://api.campaign.episerver.net/rest/{clientId}/recipients/{recipientListId}
Path Parameters
- clientIdinteger<int64>requiredDescriptionFormatint64
- recipientListIdinteger<int64>requiredDescriptionFormatint64
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonapplication/vnd.optivo.broadmail.v1+json
Form Parameters
- returnOptInMailIdbooleanDescriptionDefaultfalse
- addressstringDescription
- datastringDescription
- optinProcessIdinteger<int64>DescriptionFormatint64
- recipientIdstringrequiredDescription
Responses
201
- RestRecipient
- idstringDescription
- createdstring<date-time>DescriptionFormatdate-time
- modifiedstring<date-time>DescriptionFormatdate-time
- optInMailIdstringDescription
- linksobject[]Description
- uriBuilderobject
- relsstring[]
- relstring
- typestring
- paramsmap<string, string>
- titlestring
- uristring<uri>Formaturi
202
- RestRecipient
- idstringDescription
- createdstring<date-time>DescriptionFormatdate-time
- modifiedstring<date-time>DescriptionFormatdate-time
- optInMailIdstringDescription
- linksobject[]Description
- uriBuilderobject
- relsstring[]
- relstring
- typestring
- paramsmap<string, string>
- titlestring
- uristring<uri>Formaturi
400
409
curl
curl --request POST \
--url https://api.campaign.episerver.net/rest/{clientId}/recipients/{recipientListId} \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'returnOptInMailId=boolean' \
--data 'recipientId=string'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("returnOptInMailId", "boolean");
urlencoded.append("recipientId", "string");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api.campaign.episerver.net/rest/{clientId}/recipients/{recipientListId}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "net/http"
url = URI("https://api.campaign.episerver.net/rest/{clientId}/recipients/{recipientListId}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/x-www-form-urlencoded"
request.body = "returnOptInMailId=boolean&recipientId=string"
response = https.request(request)
puts response.read_body
python
import requests
url = "https://api.campaign.episerver.net/rest/{clientId}/recipients/{recipientListId}"
payload = 'returnOptInMailId=boolean&recipientId=string'
headers = {
'accept': 'application/json',
'content-type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// The recipient was added successfully.
{
"id": "",
"created": "",
"modified": "",
"optInMailId": "",
"links": [
{
"uriBuilder": {},
"rels": [
""
],
"rel": "",
"type": "",
"params": "",
"title": "",
"uri": ""
}
]
}202
// The recipient was added successfully, but is not immediately accessible (in case of a double opt-in).
{
"id": "",
"created": "",
"modified": "",
"optInMailId": "",
"links": [
{
"uriBuilder": {},
"rels": [
""
],
"rel": "",
"type": "",
"params": "",
"title": "",
"uri": ""
}
]
}400
// The required parameters for the recipient's creation are not provided. Ensure that "clientId", "recipientListId" and "recipientId" are added to the request.
409
// The recipient has either been blacklisted, has exceeded the bounce limit, has unsubscribed, or exists already. Ensure that "recipientId" is correct and that the recipient does not meet any of the other criteria.