CallFire Solutions

Remove Contacts from List

Follow

REMOVE CONTACTS FROM LIST

Removes contacts from a list without deleting the contacts

This operation allows removing contacts from a list without deleting the contacts.

REQUEST PARAMETERS

ParameterDemo ValueDescriptionData Type
RemoveContactsFromList   Remove attached numbers from contact list object
ContactListId Unique ID of ContactList long
ContactId * List of existing contact ids List[long]
Numbers * List E.164 11 digit numbers space or comma seperated List[PhoneNumber]

EXAMPLE: Remove one or more contacts from the list


using RestSharp;

namespace [your-namespace]
{
    public class [your-class]
    {
        public string RemoveContactFromList()
        {
            long contactListId = 1428507003; // Your ContactList Id here

            var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
            client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");

            var request = new RestRequest(string.Format("contact/list/{0}/remove", contactListId), Method.POST); 

            request.AddParameter("ContactId", "264758485003,264793000003");

            var response = client.Execute(request);
            string content = response.Content;
            return content;
        }
    }
}

 

This will remove contacts identified by "264758485003" and "264793000003" from the list identified by "188605001". Please note that the contact list is comma separated. Remember you can check by using QueryContacts and sending the corresponding ContactListId.

Response Parameters

Empty Contact List

Response Code: 204

If the contacts were successfully removed, you will receive response code 204. No XML will be included in the body.

One contact doesn't exist but others do

Response Code: 204

If some of the ids included in ContactId don't exist, you will receive response code 204 and all the others (that do exist) will be removed. No XML will be included in the body.

Empty Contact List

Response Code: 400

If you don't include any contacts in ContactId, you will receive response code 400 and the following XML will be returned:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceException xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

    <r:HttpStatus>400</r:HttpStatus>

    <r:Message>No contacts information was provided</r:Message>

</r:ResourceException>

The list doesn't exist

Response Code: 404

If you are trying to create a contact and add it to a nonexistent list, you will receive response code 404 and the following XML in the response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceException xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

   <r:HttpStatus>404</r:HttpStatus>

   <r:Message>contact list does not exist</r:Message>

</r:ResourceException>

EXAMPLE: Remove contacts by phone number


using RestSharp;

namespace [your-namespace]
{
    public class [your-class]
    {
        public string RemoveContactFromList()
        {
            long contactListId = 1428507003; // Your ContactList Id here

            var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
            client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");

            var request = new RestRequest(string.Format("contact/list/{0}/remove", contactListId), Method.POST); 

            request.AddParameter("Numbers", "14252163710,14252954687");

            var response = client.Execute(request);
            string content = response.Content;
            return content;
        }
    }
}

 

This will remove contacts with phone number "14252163710" from the list identified by "188605001". You can include more than one phone number to match. If that's the case, separate the phone numbers using comma or space as a delimiter. These phones will be matched against any of the contact's phone numbers, either mobilePhone, workPhone or homePhone. Remember you can check the result of this operation by using QueryContacts and sending the corresponding ContactListId.

Response Parameters

Empty Contact List

Response Code: 204

If the contacts were successfully removed, you will receive response code 204. No XML will be included in the body.

Have more questions? Submit a request

Comments