Skip to content

HaleyMail REST API – Lists

1. 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.

1.1 Requires

key
API Key
listIds
comma separated list of listIds
email
the contact’s email address

1.2 Optional

salutation
No additional detail
firstName
No additional detail
lastName
No additional detail
password
default is to randomly generate
company
No additional detail
address
No additional detail
address2
No additional detail
city
No additional detail
state
No additional detail
zipCode
No additional detail
country
No additional detail
phone
No additional detail

1.3 Returns

userId
the contact’s id
email
the contact’s email

1.4 Example

http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=addToList&[email protected]
{
    "ticket": {
        "fn": "addToList",
        "key": "cb5e5816e63d16d5d547039020b4083f",
        "elapsed": "0.028145",
        "api version": "1.0"
    },
    "results": {
        "status": "ok",
        "xstatus": "",
        "data": {
            "userId": "100234",
            "email": "[email protected]"
        }
    }
}

2. 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.

2.1 Requires

key
API Key
userId
the contact’s Id
listId
the list id to opt the contact out of

2.2 Returns

status
No additional detail

2.3 Example

http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=optOutOfList&listID=12345&userId=8765674

3. setDoNotSend

The setDoNotSend function sets a contact’s statusCode to 99 – opted out. The contact will subsequently not receive any mail.

3.1 Requires

key
API Key
userId
the contact’s id

3.2 Returns

status
No additional detail

3.3 Example

http://api.haleymarketing.com/?key=cb5e5816e63d16d5d547039020b4083f&fn=setDoNotSend&userID=546342

4. getDoNotSendList

The getDoNotSendList function retrieves a list of all users should never receive mail.

4.1 Requires

key
API Key

4.2 Returns

firstName
No additional detail
lastName
No additional detail
email
No additional detail
userId
No additional detail

4.3 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": "[email protected]",
                    "userId": "5060739",
                    "lastName": "Smith"
                },
                {
                    "firstName": "Joe",
                    "email": "[email protected]",
                    "userId": "5053527",
                    "lastName": "Smith"
                }
            ]
        }
    }
}

5. getLists

The getLists function returns all lists available for assigning contacts to.

5.1 Requires

key
API Key

5.2 Returns

listName
the list name
listId
the list id

5.3 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" }
            ]
        }
    }
}

6. getListMembers

The getListMembers function returns a list of contacts on a particular list.

6.1 Requires

key
API Key
listId
a valid list Id

6.2 Returns

userId
No additional detail
firstName
No additional detail
listName
No additional detail
email
No additional detail
listId
No additional detail
listOptedOut
No additional detail
statusCode
No additional detail

statusCode

99opted-out
98email is bouncing
96please do not mail
6ok – previously bounced
1opted-in
0uploaded

6.3 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": "[email protected]",
                    "listOptedOut": "0",
                    "listName": "HMGTeam",
                    "statusCode": "0",
                    "userId": "5060739",
                    "lastName": "Smith",
                    "listId": "17102"
                },
                {
                    "firstName": "Joe",
                    "email": "[email protected]",
                    "listOptedOut": "0",
                    "listName": "HMGTeam",
                    "statusCode": "0",
                    "userId": "5053527",
                    "lastName": "Smith",
                    "listId": "17102"
                }
            ]
        }
    }
}