The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Highlighted
Occasional Contributor

Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Why is the api returning 403 when adding a contact that has been deleted from Constant Contact control panel?

New emails succeed in subscribing.

13 REPLIES 13
Highlighted
Moderator

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Hello,


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?

 

Sincerely,
David B.
API Support Specialist

Highlighted
Occasional Contributor

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Message: The requested URL returned error: 403 Forbidden

end point:

https://api.constantcontact.com

using POST

Highlighted
Moderator

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Hello,

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 webservices@constantcontact.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.

 

Regards,
David B.
API Support Specialist

Highlighted
Occasional Contributor

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

$call = $utility->getApiPath() . '/ws/customers/' . $utility->getLogin() . '/contacts';

$utility->getApiPath() is the base path I gave you
 

 

Highlighted
Moderator

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Hello @TrentA,

 

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.

 

<OptInSource>ACTION_BY_CONTACT</OptInSource>

 

Here is the link to the deprecated documentation. Click Here


Regards,
Jimmy D.
Tier II API Support Engineer
Highlighted
Occasional Contributor

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

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>jeremiah@demacmedia.com</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>
Highlighted
Moderator

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Hello @TrentA,

 

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.


Regards,
Jimmy D.
Tier II API Support Engineer
Highlighted
Occasional Contributor

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

How come I don't get errors when a new contact is subscribed?

Highlighted
Moderator

Re: Getting 403 when adding a contact that has been deleted from Constant Contact control panel

Hello @TrentA,

 

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.


Regards,
Jimmy D.
Tier II API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured