UpdateContact

Updates a contact by ID

This method updates a contact within your account. The information entered will replace any existing information for the contact.

Setting the OptInType to 'VerifiedDouble' will result in a double opt-in confirmation email being sent to the contact. The result will state that the contact's OptInType is 'Double' and Status is 'PendingOptIn'. These will only update to 'VerifiedDouble' and 'Subscribed' respectively once the contact has clicked the link in the confirmation email, at which point they will be added to the account.

Furthermore, this method can also be used to create a contact. This is done by using an ID that doesn't already exist, or by using 0, plus using an email address that doesn't already exist within your account. The contact will be created, with a valid ID assigned, in 'All contacts'.

SOAP action: http://apiconnector.com/v2/ApiService/UpdateContact

📘

Input and output parameters

The input and output parameters for this method are:

Input parameters

  • Contact Id - required; integer
  • Email - required; string
  • OptInType - optional; string ('Unknown', 'Single', 'Double', 'VerifiedDouble')
  • EmailType - optional; string ('PlainText', 'Html')
  • DataFields - optional; array of ContactData
    • ContactData
      • Key - string
      • Value - anyType (please note: the data type needs to be defined for the value, such as 'string', 'numeric', 'date' or 'boolean'; e.g., for 'Firstname', the XML would need to be as follows - <apic:Value xsi:type="xsd:string">John</apic:Value>)

Output parameters

  • UpdateContactResult
    • Id - integer
    • Email - string
    • OptInType - string ('Unknown', 'Single', 'Double', 'VerifiedDouble')
    • EmailType - string ('PlainText', 'Html')
    • DataFields - optional; array of ContactData
      • ContactData
        • Key - string
        • Value - anyType
    • Status - string ('Subscribed', 'Unsubscribed', 'SoftBounced', 'HardBounced', 'IspComplained', 'MailBlocked', 'PendingOptIn', 'DirectComplaint', 'Deleted', 'SharedSuppression', 'Suppressed', 'NotAllowed', 'DomainSuppression', 'NoMxRecord')

Example

using (var client = new ApiServiceClient())
{
	client.ClientCredentials.UserName.UserName = "username";
	client.ClientCredentials.UserName.Password = "password";

	var contactId = 1;
	var contact = client.GetContactById(contactId);
	var dataFields = contact.DataFields.ToList();
	dataFields.Add(new ApiContactData { Key = "Address", Value = "TestAddress" });
	contact.DataFields = dataFields.ToArray();
	var updatedContact = client.UpdateContact(contact);
}