We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

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

TrentA
Regular Participant

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
David_B.
Moderator

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

TrentA
Regular Participant

Message: The requested URL returned error: 403 Forbidden

end point:

https://api.constantcontact.com

using POST

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

TrentA
Regular Participant

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

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

 

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
TrentA
Regular Participant

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>

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
TrentA
Regular Participant

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

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
TrentA
Regular Participant

In the deprecated api link you sent, where do I get the contact-id of a deleted Contact:

 

https://api.constantcontact.com/ws/customers/{username}/contacts/{contact-id}

Hello @TrentA,

 

That link is just for updating a contact. It sounds like this is a new integration so I highly suggest switching to our v2 API. However; if you wish to continue with the v1 API please understand since it is deprecated there are no updates or fixes to this version.

 

You would need to do a GET in order to retrieve the Contact ID. That documentation can be found here.


Regards,
Jimmy D.
Tier II API Support Engineer
TrentA
Regular Participant

Where's the version 1 documentation for

Opting in a Contact Who Was Deleted

Hello,

 

All of our v1 Documentation can be found here: 
https://community.constantcontact.com/t5/Documentation/bg-p/bl_dev_doc

 

To look at contacts specifically, see the links in our documentation here:
https://community.constantcontact.com/t5/Documentation/Contacts-Overview/ba-p/25963

 

Please let me know if you have any other questions for me.

Sincerely,
David B.
API Support Specialist

Developer Portal

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

Visit Page