HaleyMail REST API – Lists
addToList
The addToList function will add a single contact to the lists specified. If the contact does not exist, a new contact is created. If optional data is provided, those fields will be updated in an existing contact. Fields not included are not updated.
Requires
key API Key
listIds comma separated list of listIds
email the contact’s email address
Optional
salutation
firstName
lastName
password default is to randomly generate
company
address
address2
city
state
zipCode
country
phone
Returns
userId the contact’s id
email the contact’s email
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=addToList&email=test@test.com
{
"ticket": {
"fn": "addToList",
"key": "cb5e5816e63d16d5d547039020b4083f",
"elapsed": "0.028145",
"api version": "1.0"
},
"results": {
"status": "ok",
"xstatus": "",
"data": {
"userId":"100234",
"email":"test@test.com"
}
}
optOutOfList
The optOutOfList function opt’s a contact out of a single list. No mail will be sent to this contact from this list. To halt all mail to a contact, use setDoNotSend
Requires
key API Key
userId the contact’s Id
listId the list id to opt the contact out of
Returns
status
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=optOutOfList&listID=12345&userId=8765674
setDoNotSend
The setDoNotSend function sets a contact’s statusCode to 99 – opted out. The contact will subsequently not receive any mail.
Requires
key API Key
userId the contact’s id
Returns
status
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=setDoNotSend&userID=546342
getDoNotSendList
The getDoNotSendList function retrieves a list of all users should never receive mail.
Requires
key API Key
Returns
firstName
lastName
email
userId
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=setDoNotSend&userID=546342
{
"ticket": {
"fn": "getDoNotSendList",
"key": "cb5e5816e63d16d5d547039020b4083f",
"elapsed": "0.160991",
"api version": "1.0"
},
"results": {
"status": "ok",
"xstatus": "",
"data": {
"list_meta": {
"total": "2"
},
"list": [
{
"firstName": "Bob",
"email": "bsmith@test.com",
"userId": "5060739",
"lastName": "Smith"
},
{
"firstName": "Joe",
"email": "jsmith@haleymarketing.com",
"userId": "5053527",
"lastName": "Smith"
}
]
}
}
}
getLists
The getLists function returns all lists available for assigning contacts to.
Requires
key API Key
Returns
listName the list name
listId the list id
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=getLists
{
"ticket": {
"fn": "getLists",
"key": "cb5e5816e63d16d5d547039020b4083f",
"elapsed": "0.028145",
"api version": "1.0"
},
"results": {
"status": "ok",
"xstatus": "",
"data": {
"list_meta": {
"total": "14"
},
"list": [
{
"listName": "Great Ideas",
"listId": "16811"
},
{
"listName": "NEWTEST",
"listId": "17066"
},
{
"listName": "NEWTEST2",
"listId": "17067"
},
{
"listName": "SB List",
"listId": "16807"
},
{
"listName": "Test",
"listId": "17075"
},
{
"listName": "Test List",
"listId": "16814"
},
{
"listName": "Test 5",
"listId": "16818"
},
{
"listName": "TEST2 LIST",
"listId": "16815"
},
{
"listName": "TESTLIST3",
"listId": "16816"
},
{
"listName": "TESTLIST4",
"listId": "16817"
},
{
"listName": "Sales Upload",
"listId": "17081"
}
]
}
}
}
getListMembers
The getListMembers function returns a list of contacts on a particular list.
Requires
key API Key
listId a valid list Id
Returns
userId
firstName
listName
email
listId
listOptedOut
statusCode
99 opted-out
98 email is bouncing
96 please do not mail
6 ok – previously bounced
1 opted-in
0 uploaded
Example
http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=getListMembers&listId=17102
{
"ticket": {
"fn": "getListMembers",
"key": "cb5e5816e63d16d5d547039020b4083f",
"elapsed": "0.160991",
"api version": "1.0"
},
"results": {
"status": "ok",
"xstatus": "",
"data": {
"list_meta": {
"total": "2"
},
"list": [
{
"firstName": "Bob",
"email": "bsmith@test.com",
"listOptedOut": "0",
"listName": "HMGTeam",
"statusCode": "0",
"userId": "5060739",
"lastName": "Smith",
"listId": "17102"
},
{
"firstName": "Joe",
"email": "jsmith@haleymarketing.com",
"listOptedOut": "0",
"listName": "HMGTeam",
"statusCode": "0",
"userId": "5053527",
"lastName": "Smith",
"listId": "17102"
}
]
}
}
}