I have the need to synchronize the data in certain Salesforce tables (user, account, opportunity, lead, task, contact, etc.) to a local database. For reasons that I won't go into here, I can't use the streaming API. I want to kick off a local process every X minutes that will:

  1. Go through each of the tables on my list
  2. Insert any new records
  3. Update any existing records that were updated
  4. Delete any records locally that were deleted on the server (either deleted directly or indirectly (e.g. through a foreign key relationship, like when an account is deleted its associated tasks are deleted as well).

Can you please offer advice on what API's might be good to use here, and whether one stands out more than the others? Are there any specific design recommendations that might be useful for achieving this goal? Or is there really no practical difference between what REST vs SOAP can do?

It comes down to what is the easiest to maintain/implement? Is there some other route that might be beneficial to use (example: bulk data load to start out followed by outbound messaging tied to all of the objects in question to get updates/inserts/deletes)?

I am using C#/.net.

1 Answer 1


The Replication API is the most reliable method for data replication. It includes two functions, getUpdated and getDeleted; the former describes newly created and updated records, while the latter indicates records that have been deleted. You can use this API to accurately replicate data in your remote system without worrying about determining specific queries. Once you have a list of ID values, you can use retrieve to quickly export the data in batches of up to 2000 records. The replication API has a specific advantage that it is designed to make sure you can't miss records and won't retrieve duplicates, both of which are possible when directly querying based on CreatedDate/LastModifiedDate fields (because of in-flight transactions that won't appear in queries until they are fully committed).

  • I see that for getUpdated, "Results are returned for no more than 30 days previous to the day the call is executed." So that means that in order to use this, I would need to first bulk load all of the data up to the start date, and then use replication API to keep it up to date? Jan 2, 2014 at 19:32
  • Correct. A full one-time sync is required before you can use the replication API. If you get out of sync (because the last sync was more than 30 days ago), then you must repeat the process.
    – sfdcfox
    Jan 2, 2014 at 19:35
  • And do you have a favorite API to use for a full one-time sync? Jan 2, 2014 at 19:43
  • @YaakovEllis Since we're already using the SOAP API for getUpdated, may as well do a full sync using it as well.
    – sfdcfox
    Jan 2, 2014 at 20:11
  • 1
    @Guy It looks that way. I'm pretty sure salesforce.com recommends syncing every few minutes. The longer you wait between syncs, the more data you're going to have to sync anyways.
    – sfdcfox
    Nov 16, 2016 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .