List Recipients
Use the API to obtain a list of recipient objects. Include group_id to only return recipients in the specified group. You can use the offset and limit parameters for pagination.
Request
import requests
data = {
}
response = requests.post("https://api-us1.stannp.com/v1/recipients/list?api_key={API_KEY}", data=data)
print(response.text)
Response
[ { "id": "1943", "account_id": "5", "title": "Mr", "firstname": "John", "lastname": "Example", "company": "Example Co", "address1": "123 Example street", "city": "Example Town", "country": "US", "postcode": "EX12 3AB" }, { "id": "1944", "account_id": "5", "title": "Mrs", "firstname": "Jane", "lastname": "Example", "company": "Example Co", "address1": "123 Example street", "city": "Example Town", "country": "US", "postcode": "EX12 3AB" } ]
Get a Single Recipient
Obtain the recipient object for the recipient ID specified.
Request
import requests
data = {
}
response = requests.post("https://api-us1.stannp.com/v1/recipients/get/1234?api_key={API_KEY}", data=data)
print(response.text)
Response
{ "id": "1943", "account_id": "5", "title": "Mr", "firstname": "John", "lastname": "Example", "company": "Example Co", "address1": "123 Example street", "city": "Example Town", "country": "US", "postcode": "EX12 3AB" }
Create a New Recipient
Use the API to create a new recipient.
Request
import requests
data = {
"firstname": "Steve",\n "lastname": "Parish",\n "address1": "Unit 12 Taw Trade Park",\n "address2": "Suite 100",\n "address3": "Building A",\n "city": "Barnstaple",\n "postcode": "EX31 1JZ",\n "country": "US",\n "email": "steve.parish@example.com",\n "phone_number": "+11234567890",\n "ref_id": "SP12345",\n "group_id": "123",\n "on_duplicate": "update",\n "test_level": "fullname",\n
}
response = requests.post("https://api-us1.stannp.com/v1/recipients/new?api_key={API_KEY}", data=data)
print(response.text)
Response
{ "id": "1941", "valid": true }
Delete a Recipient
Use the API to permanently delete a recipient from your account.
Request
import requests
data = {
"id": "12345",\n
}
response = requests.post("https://api-us1.stannp.com/v1/recipients/delete?api_key={API_KEY}", data=data)
print(response.text)
Response
{ "success": true }
Import a Data File
Use the API to import a data file into your account.
Request
import requests
data = {
"file": "/home/user/Desktop/data.csv",\n "group_id": "123",\n "duplicates": "update",\n "no_headings": "",\n "mappings": "title,firstname,lastname,company,address1,address2,city,postcode,country,custom,custom,skip",\n
}
response = requests.post("https://api-us1.stannp.com/v1/recipients/import?api_key={API_KEY}", data=data)
print(response.text)
Response
{ "success": true }