Use web services to connect a site to an external customer database

 

This article outlines the steps for building an application that lets you synchronize your customer list between two systems. 

Using the built-in API framework, you can build the relevant bridges so you can synchronize two databases at business-appropriate intervals.

Programming skills are required to develop such a bridge. You can use any programming language that supports web services to write your applications that communicate with this system.

You can find a sample definition for the Customer/CRM related web service here. But for production use, visit the API Integration screen. Choose Site Settings > API Integration to obtain the proper WSDL URL for the specific site you want to integrate with.

Retrieve information from the system

  1. Review web service method ContactList_Retrieve. This method enables you to retrieve a list of contacts that have been updated on this system from a given date.
  2. Authenticate yourself with each call to the system. Pass in your user name and password and the siteId that you want to retrieve data from. If you don't know the siteId of your site, look on the API Integration page, accessible from the Admin menu.

  3. The method also required three variables:

    • LastUpdateDate: The date at which you want any new or updated contact records returned.
    • RecordStart: The offset of the records to be returned. Initially, it's necessary to pass in a value of 0. Each call to the method returns 100 records.
    • MoreRecords: A reference variable set to true if there are more records to retrieve. If the value is true, then call the method again, but add 100 to the original offset. On the second call, the value of RecordStart is 100, and so on. Repeat this step until false is returned to get the entire list of contacts.

Add and update information on the system

  1. Review web service method ContactList_UpdateInsert. This method enables you to pass in an array of contacts and update them in bulk in this system.
  2. Authenticate yourself with each call to the system. Pass in your user name and password and the siteId that you wish to retrieve data from. If you don't know the siteId of your site, contact support to get this value.

  3. The method also takes in another variable, which is an array of type Contact.

Similar to the import routine, you can use the External ID property to set a unique identifier value for each customer. If this value is present, then customers are matched and updated accordingly. For example, if every customer in your system has a member number, then assign that to the External ID property. If you do not use this property, then the unique identifier used is a customer's email address. If neither is provided, then contacts are added and never updated, as no unique identifier exists.