CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Merge API
Pages: [1]

Author Topic: Merge API  (Read 585 times)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Merge API
July 09, 2013, 06:07:09 pm
I've got about 2,000 contacts to merge that I detected using a custom php script. Trying to figure out if there is a way to merge via the API.

Brian

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Merge API
July 10, 2013, 12:05:48 am
There is no merge functionality in the API. Obviously you could use the Contact API (update and delete actions) to create your own merge process. Alternatively you can have a look at the functions in the core dedupe process. Possibly there are functions you can use in CRM/Contact/Form/Merge.php? Haven't looked at it myself though so I do not know.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Merge API
July 10, 2013, 02:49:14 pm
Actually Erik - there IS a contact.merge action.

However, there is no test for it so - it is quasi part of the API. (I wouldn't personally incorporate it into an ongoing piece of code without contributing back a test to ensure it continues to work)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Merge API
July 11, 2013, 06:45:39 am
I stand corrected! But I agree with Eileen, do contribute back a test so it will continue to work....
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: Merge API
July 11, 2013, 05:14:32 pm
Thanks. I started with Erik's first piece of advice, and although it took some time, I've got it working.

Brian

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Merge API

This forum was archived on 2017-11-26.