Why is the api returning 403 when adding a contact that has been deleted from Constant Contact control panel?
New emails succeed in subscribing.
Thank you for reaching out to the API Support team here at Constant Contact.
There are a variety of problems that can lead to a 403 error, such as going over your API Key's calls per second or per day limitation. What is the error response message that is coming back with the 403?
Which endpoint are you making the call to?
Are you using PUT or POST to add the contact?
API Support Specialist
Message: The requested URL returned error: 403 Forbidden
Thank you for that information.
That is our base API URL. Would you be able to provide us with the full URL you are POSTing to?
Also, if you prefer we can do some research on your specific issue on our end. If you email email@example.com with your API Key, an example of a contact you are trying to add, and a snippet of the code you are using (if available) we can look into this in more detail.
API Support Specialist
$call = $utility->getApiPath() . '/ws/customers/' . $utility->getLogin() . '/contacts';
$utility->getApiPath() is the base path I gave you
Based on the extended URL you are using our v1 API. While that version of the API is technically deprecated I can provide you with a link to the old documentation if needed. The basis of the issue however; is that since the contact once existed in the account and you are trying to bring them back in to the account you are updating that contact which requires the use of a PUT and not a POST. Most likely the opt-in source will also need to be listed as ACTION_BY_CONTACT.
Here is the link to the deprecated documentation. Click Here
Can you check my xml, I'm getting a new error: "The requested url returned error: 415 Unsupported Media Type"
<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <title>TitleNode</title> <updated>2017-07-20T15:40:55+01:00</updated> <author> <name>CTCT Samples</name> </author> <id>urn:uuid:E8553C09F4xcvxCCC53F481214230867087</id> <summary type="text">Customer document</summary> <content type="application/vnd.ctct+xml"> <Contact xmlns="http://ws.constantcontact.com/ns/1.0/"> Customer document <EmailAddress>firstname.lastname@example.org</EmailAddress> <FirstName>jeremiah serrano</FirstName> <LastName /> <MiddleName /> <CompanyName /> <JobTitle /> <OptInSource>ACTION_BY_CONTACT</OptInSource> <HomePhone /> <WorkPhone /> <Addr1 /> <Addr2 /> <Addr3 /> <City /> <StateCode /> <StateName /> <CountryCode /> <PostalCode /> <SubPostalCode /> <Note /> <EmailType /> <CustomField1 /> <CustomField2 /> <CustomField3 /> <CustomField4 /> <CustomField5 /> <CustomField6 /> <CustomField7 /> <CustomField8 /> <CustomField9 /> <CustomField10 /> <CustomField11 /> <CustomField12 /> <CustomField13 /> <CustomField14 /> <CustomField15 /> <ContactLists> <ContactList id="http://api.constantcontact.com/ws/customers/mediademac/lists/1" /> </ContactLists> </Contact> </content> </entry>
Your XML is missing several components and the formatting is not the same as the example listed in the link given in the previous reply. If this is an already established integration then I would go over the document I previously linked and double check on the example XML listed. If this is something you are setting up new I suggest to switch to our v2 API which is easier to work with.
Our v2 API documentation can be found here.
How come I don't get errors when a new contact is subscribed?
New contacts use POST which is what you are already doing, and they can either be added with ACTION_BY_OWNER or ACTION_BY_CONTACT. Since this issue is with adding in a contact that was deleted is must be done with a PUT and it must be done with ACTION_BY_CONTACT.