You also need to pass the request body in XML that represents the contact detail, and set the request header, Content-type, to application/atom+xml.
The use of this API to create a contact is designed to handle a small number of contacts (i.e. less than 25). To add a large number of contacts, use the Activities API resource. (As discussed in the Constant Contact API Terms and Conditions, intentional and unintentional misuse of this discrete API to frequently manage large sets of contacts is subject to API access or account termination).
Because we use the Atom specification for XML, there are several elements that are required even though they are not used by the server and are replaced upon a successful contact creation. These elements are <id>, <title>, <author>, and <updated> elements. The <title> and <author> elements may be empty. The <id> must contain a URI, but since the value is not used by the server, any URI will work. The server does not check for uniqueness when creating a contact because a new unique ID will be created anyway. The <updated> element must contain a date or date/time value, but again the value is not used by the server.
The actual contact detail is described in <Contact> element. The following XML describes the minimal XML body required to create a new contact.
If you want to add more details when you create a new contact, you can do so by adding additional elements under <Contact> element at the same level as <EmailAddress>.
There are two options for <OptInSource> elements: ACTION_BY_CONTACT and ACTION_BY _CUSTOMER. If the contact is adding himself or herself, use ACTION_BY_CONTACT. If you are adding the contacts on their behalf, use ACTION_BY_CUSTOMER. Please note that if you use ACTION_BY_CONTACT, a welcome letter, as specified in your account, will be sent out to them.
Contacts who are added with "ACTION_BY_CUSTOMER" do not receive a welcome email. This value MUST be used whenever the contact is being added by anyone other than the contact themselves. Contacts who are added with "ACTION_BY_CUSTOMER" will receive AutoResponder sequences based on the settings of the list they are being added to. Contacts who are added with "ACTION_BY_CUSTOMER" are not included on your "Visitor Signup Report".
Contacts who are added with "ACTION_BY_CONTACT" receive a welcome email. This value *CAN ONLY* be used if the contact is being added as a direct result of an action by the contact themselves (ie they are adding themselves via a public web form). Contacts who are added with "ACTION_BY_CONTACT" will receive AutoResponder sequences. Contacts who are added with "ACTION_BY_CONTACT" are included on your "Visitor Signup Report".