Add or update one recipient, optionally providing demographic fields. Existing recipients will have their demographics undated, but their unsubscribe status will not be changed so you don't need to fear re-subscribing someone based on this import. Empty demographic values do not override existing data. Recipients cannot be added or updated when using a Foreign Members table. Provide the topics that the person should be subscribed to. If the recipient already exists, they will not be unsubscribed from topics that are not listed.
Post
/API/Rest/Recipients/AddOne
| topics | (Optional) An array of the topics that this recipients should be marked as subscribed to |
| emailAddress | The email address of the new or updated recipient. |
| demographics | (optional) A dictionary of keys and values to be imported. The key is the demographic name, the value is the data to add or replace. |
CreateEditMember
No Permission
Using a foreign members table
Email address is banned.
Invalid email address
Topic: is not valid
Demographic: is not a valid demographic
Too many API calls
Database error
Unknown error
Recipient added or Recipient updated
Add a new recipient.
using System;
using System.Net.Http;
using System.Text;
string url = "https://example.com/API/Rest/Recipients/AddOne";
string message = "{\"accountName\":\"acme\",\"login\":\"ApiUser\",\"password\":\"YOUR_PASSWORD\",\"topics\":[\"Daily\",\"Weekly\"],\"emailAddress\":\"fjfdhfh@aol.com\",\"demographics\":{\"firstname\":\"Fred\",\"lastName\":\"Smith\"}}";
// Reuse HttpClient for multiple requests in production code.
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
{
request.Content = new StringContent(message, Encoding.UTF8, "application/json");
using (HttpResponseMessage response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
# encoding: utf-8
require 'rest-client'
require 'json'
url = 'https://example.com/API/Rest/Recipients/AddOne'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'YOUR_PASSWORD', 'topics'=>['Daily','Weekly'], 'emailAddress'=>'fjfdhfh@aol.com', 'demographics'=>{'firstname'=>'Fred', 'lastName'=>'Smith'}}
response = RestClient.post(url, args.to_json, :content_type => "application/json;charset=utf-8")
puts response
import requests
url = "https://example.com/API/Rest/Recipients/AddOne"
args = {'accountName':'acme', 'login':'ApiUser', 'password':'YOUR_PASSWORD', 'topics':['Daily','Weekly'], 'emailAddress':'fjfdhfh@aol.com', 'demographics':{'firstname':'Fred', 'lastName':'Smith'}}
headers = {'Content-Type': 'application/json'}
resp = requests.post(url, json=args, headers=headers)
if resp.status_code == 200:
print(resp.text)
curl --request POST --header "Content-Type: application/json" --data '{"accountName":"acme","login":"ApiUser", "password":"YOUR_PASSWORD", "topics":["Daily","Weekly"], "emailAddress":"fjfdhfh@aol.com", "demographics":{"firstname":"Fred", "lastName":"Smith"}}' "https://example.com/API/Rest/Recipients/AddOne"