Contact Update Contact List Brief XML

SOLVED
Go to solution
Member

Contact Update Contact List Brief XML

Using one of the sample web apps, I generated this xml (saved off during a debug)

 

Each list is a single tag entry with the listID as the suffix, however on the following API snipit it shows more detail

...snipit

        <ContactList id="http://api.constantcontact.com/ws/customers/joesfl​owers/lists/3">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/lists/3" rel="self" />
          <OptInSource>ACTION_BY_CONTACT</OptInSource>
          <OptInTime>2009-11-20T20:41:06.595Z</OptInTime>
        </ContactList>

snipit...

I'm not sure that I currently know exactly when a contact opted in, which occurs when they choose free trial, and then perhaps again when they're paid (our email is information), so the moment that the sales person marks their record Yes to receive one of our email messages sent by CtCt, isn't really important to us, so, is it Okay as seen below to send the brief format ContactList XML?

 

<entry xmlns="http://www.w3.org/2005/Atom">
    <title type="text" />
    <updated>2008-07-23T14:21:06.407Z</updated>
    <author>
        <name>Constant Contact</name>
    </author>
    <id>http://api.constantcontact.com/ws/customers/JeffP/contacts/2</id>
    <summary type="text">Contact</summary>
    <content type="application/vnd.ctct+xml">
        <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/JeffP/contacts/2">
            <EmailAddress>jp@global.net</EmailAddress>
            <FirstName />
            <LastName />
            <MiddleName />
            <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
            <HomePhone />
            <Addr1 />
            <Addr2 />
            <Addr3 />
            <City />
            <StateCode />
            <StateName />
            <CountryCode />
            <CountryName />
            <PostalCode />
            <SubPostalCode />
            <ContactLists>
                <ContactList id="http://api.constantcontact.com/ws/customers/JeffP/lists/1" />
                <ContactList id="http://api.constantcontact.com/ws/customers/JeffP/lists/2" />
                <ContactList id="http://api.constantcontact.com/ws/customers/JeffP/lists/3" />
            </ContactLists>
        </Contact>
    </content>
</entry>

 

 

1 ACCEPTED SOLUTION

You're correct, some read only fields must be included for XML validation per ATOM spec, so there could be confusion here.  These read only fields are not required and your XML will work for both POST/PUT requests (create/update). 

 

You're also correct, if you keep the data synced on your database side, you won't need to do a GET requset prior to updating those contacts and it can save API calls.  The only caveat would be that if something gets out of sync due to interaction with a Constant Contact UI or flow, you would be out of sync and possibly lose data.  Chances are probably low on that, but it's still worth considering that you will need to do a data refresh type flow nightly if you want to keep data synced on your end or use our "UpdatedSince" feature to get any updates in Constant Contact on a regular basis.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

3 REPLIES 3
Moderator

The information in the response you're seeing is actually set by us when we add the Contact to the lists for you.  The nodes are actually read only and the XML you posted is complete for creating a Contact.

Dave Berard
Senior Product Manager, Constant Contact

Perhaps I should restate for my clarification, as these are the send XML captured just prior to the Get request during an Update not create.

Both the snipt from the API documentation and my full XML are what's Sent in the Get, do you also refer to this as a "Response"? I would have thought that the response occurs after the Get(?)

I thought the snipit was an Update similar to my Update of an existing contact, not creating a Contact.

And I think I've seen in other areas of the API documentation that although the fields are read-only we still have to include the XML tags/fields, even though CtCt will update the values, and I thought that this was one of those sections?

 

This SSIS process will be to update existing contacts that a database trigger has placed in a queue, but this is good to know for any that are new for a sample create.

The CtCt sample web projects for updates or creates get all of the customers ContactLists for the update/create each time; I have an INI (xml) file that contains List name, ID, our database fieldname, tablename, label name for updating the CRM database, and will be maintained by the person who creates the lists - correct me if I'm wrong, I can just create the list xml tag/string and append what my INI file thinks is the right ListID for each selected in the CRM database, rather than fetching the Customer's entire ContactLists collection for every contact update. I think that it will save a considerable amount of processing time/resources for both our system and CtCt's.

You're correct, some read only fields must be included for XML validation per ATOM spec, so there could be confusion here.  These read only fields are not required and your XML will work for both POST/PUT requests (create/update). 

 

You're also correct, if you keep the data synced on your database side, you won't need to do a GET requset prior to updating those contacts and it can save API calls.  The only caveat would be that if something gets out of sync due to interaction with a Constant Contact UI or flow, you would be out of sync and possibly lose data.  Chances are probably low on that, but it's still worth considering that you will need to do a data refresh type flow nightly if you want to keep data synced on your end or use our "UpdatedSince" feature to get any updates in Constant Contact on a regular basis.

Dave Berard
Senior Product Manager, Constant Contact

View solution in original post

Developer Portal

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

Visit Page