Reply
New Member
beehive_david
Posts: 2
Registered: ‎11-21-2008

PHP Put Resubscribe Contact Status 400 Bad Request

Hi all.

I'm trying to 'put' back and resubscribe users to our list. I'm using a test email of mine for the time being, but keep getting a status 400 Bad Request.

Below is what I'm putting:

Update: Please see xml.txt attachment below. If someone could advise me how I can paste in XML code, I'd be very grateful :)

The headers I get back are:

(
=> 1.1
=> 400
=> 400 Bad Request
=> Mon, 24 Nov 2008 11:37:14 GMT
=> IBM_HTTP_Server
=> private, no-cache, no-cache="set-cookie,set-cookie2"
=> no-cache
=> close
=> chunked
=> text/html; charset=ISO-8859-1
=> en-US
)

I'm able to subscribe new contacts, and unsubscribe perfectly. It's just when I try and let people resubscribe, I have problems.
New Member
beehive_david
Posts: 2
Registered: ‎11-21-2008

Not too sure how I post XML

Not too sure how I post XML in here. Can someone please advise? Thanks.
Regular Participant
mcushman
Posts: 31
Registered: ‎05-28-2008

RE: PHP Put Resubscribe Contact Status 400 Bad Request

In your XML file try to change

<entry>

to: <entry xmlns="http://www.w3.org/2005/Atom">

and

ACTION_BY_CUSTOMER

to: ACTION_BY_CONTACT


So your Xml should look some thing like this




<entry xmlns="http://www.w3.org/2005/Atom">

<id>http://api.constantcontact.com/ws/customers/USERNAME/contacts/12764</id>

<title type="text">Contact: test@myemail.com</title>

<updated>2008-11-24T11:37:14.556Z</updated>

<content type="application/vnd.ctct+xml">

<Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/USERNAME/contacts/12764">

<EmailAddress>test@myemail.com</EmailAddress>

<OptInSource>ACTION_BY_CONTACT</OptInSource>

<ContactLists>

<ContactList id="http://api.constantcontact.com/ws/customers/USERNAME/lists/1"/>

</ContactLists>

</Contact>

</content>

<author> </author>

</entry>



If the contact you are trying to add is on the Do Not Mail List then ACTION_BY_CUSTOMER will give you a error 403 Forbidden. Any contact that is on the Do Not Mail List need to add themselves so you need to use ACTION_BY_CONTACT

You can also "Remove" and Re-add Contacts. A contact that is Removed is valid in every way except they are not on any Contact Lists and thus they will not receive any emails.
To 'Remove' a contact, you simply update (PUT) their atom entry with an empty ContactLists tag.
They will not get any emails.
To 'Re-add' the contact, simply update (PUT) their entry back with the Contact List or Lists you want.

Mike C Support Engineer, Constant Contact