400 Error using PHP API examples

newhanoian
Occasional Participant

400 Error using PHP API examples

Hello,


oddly CC support doesn't help out with the API and they've sent me here...


I'm using the sample PHP code from cc_class.php to generate XML to send to CC server. Curl tells me that the response is a 400 error. I am sending the following XML when I get the error:


 


<?xml version="1.0" encoding="UTF-8"?>

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

    <title>TitleNode</title>

    <updated>2010-09-16T15:35:22+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>sfwxyz@yahoo.com</EmailAddress>

            <FirstName></FirstName>

            <LastName></LastName>

            <MiddleName></MiddleName>

            <CompanyName></CompanyName>

            <JobTitle></JobTitle>

            <OptInSource>ACTION_BY_CONTACT</OptInSource>

            <HomePhone></HomePhone>

            <WorkPhone></WorkPhone>

            <Addr1></Addr1>

            <Addr2></Addr2>

            <Addr3></Addr3>

            <City></City>

            <StateCode></StateCode>

            <StateName></StateName>

            <CountryCode></CountryCode>

            <PostalCode></PostalCode>

            <SubPostalCode></SubPostalCode>

            <Note></Note>

            <EmailType></EmailType>

            <CustomField1>26280</CustomField1>

            <CustomField2>fap01</CustomField2>

            <CustomField3></CustomField3>

            <CustomField4></CustomField4>

            <ContactLists>

                <ContactList id="2" />

            </ContactLists>

        </Contact>

    </content>

</entry>


 


in CC_Utility I have my CC username, the password I use to log in to the CC main site, and an API key that I generated.


 


What am I doing wrong?


 


 


Thanks for any help

Tom Lancaster


http://newhanoian.xemzi.com


 

2 REPLIES 2
newhanoian
Occasional Participant

nevermind - as often happens, the act of asking the question has turned a lightbulb on.


The contactlist "id" is not actually the list id. It's the list uri: 'http://api.constantcontact.com/ws/customers/newhanoian/lists/2'


Better nomenclature might have prevented that misunderstanding, but at least it's working now.

Tom Lancaster


http://newhanoian.xemzi.com


 

David_J
Employee

I apologize for any inconvenience that this issue has caused. We do have this documented in Creating a Contact, but I can see how this would be confusing and I do apologize for that. I am glad that you were able to resolve this issue however.


I do want to comment on CTCT Support sending you here. Our phone/chat support channels are meant for support with our actual user interface, and not meant to be developer/API support. With that being said, we do have support representatives that handle API related issues from either this forum, or by emailing our webservices support team. If you contact us by these channels, we will be more than happy to assist you with integration questions. If you do have any other questions please do not hesitate to let us know. Thank you.

David J

Developer Portal

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

Visit Page