I am trying to write an interface from an iSeries (AS400) platform using RPG as the programming language, so none of your examples apply.
Currently, I'm trying to add a new contact and am getting Error 415 with the following message:
Content type: 'text/xml' is not accepted by this collection. Accepted type(s) are: 'application/atom+xml;type=entry'.
Can you tell me where I am going wrong?
Here is the XML I am sending with the POST. I reconstructed it from the XML I retrieved from a GET:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://api.constantcontact.com/ws/customers/healthywoman/contacts</id>
<title type="text">Contacts for Customer: healthywoman</title>
<link href="contacts"></link>
<link href="contacts" rel="self"></link>
<author>
<name>healthywoman</name>
</author>
<updated>2011-09-14T17:01:58.795Z</updated>
<link href="/ws/customers/healthywoman/contacts" rel="first"></link>
<content type="application/atom+xml">
<entry>
<id>data:,none</id>
<title type="text">Contact: me@chs.net</title>
<updated>2011-09-14T17:01:58.833Z</updated>
<author></author>
<name>Constant Contact</name>
<summary type="text">Contact</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
<EmailAddress>me@chs.net</EmailAddress>
<EmailType>HTML</EmailType>
<Name>April</Name>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/healthywoman/lists/1" />
</ContactLists>
</Contact>
</content>
</entry>
</content>
</feed>
Thanks,
Danny
Hey Kay,
You are using the wrong content-type. You need to use
application/atom+xml
Also if you are creating a new contact you don't want to use information from a previous GET. You want to use this information below
<entry xmlns="http://www.w3.org/2005/Atom"> <title type="text"> </title> <updated>2008-07-23T14:21:06.407Z</updated> <author></author> <id>data:,none</id> <summary type="text">Contact</summary> <content type="application/vnd.ctct+xml"> <Contact xmlns="http://ws.constantcontact.com/ns/1.0/"> <EmailAddress>test_100@example.com</EmailAddress> <OptInSource>ACTION_BY_CONTACT</OptInSource> <ContactLists> <ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1" /> </ContactLists> </Contact> </content> </entry>
Now if you are trying to do a GET on a specific contact and modify it. You would reconstruct your XML and do a PUT to get the information into constant contact.
Please let me know if this helps.
Thanks for the reply, Ryan.
This is Danny...the developer, not Kay.
I have application/atom+xml as the content type in the header just before <Entry>. (12th line)
And your example uses <content type="application/vnd.ctct+xml"> in the <Entry>, just as mine does.
Sorry, I don't understand.
Danny
Hey Danny,
If you are trying to create a new contact use the XML i provided and do a POST to the URI of contacts.
https://api.constantcontact.com/ws/customers/username/contacts
That will create a new contact for you.
The holidays have come and gone. For many seasonal businesses, this means the rush of shoppers has decreased as well. Instead of turning off the lights and waiting for spring, make your email marketi...
See Article