My understanding (after googling this intermittently throughout the last 12 months and vainly hoping the answer to be different each time) is that there is no Salesforce API Endpoint that a user could feed an array of Contact Id values into to perform a Merge operation.

I understand the only way to perform a DML Merge operation is to write some Apex Code that wraps the DML operation, but is it possible to write an Apex class that accepts n-number ContactIds and performs the DML Merge operation on those records and is exposed as an API endpoint that another service could call?

Are there any github examples or (free) AppExchange apps that offer this functionality?

I don't need a UI, I just need an endpoint that accepts my Contact Ids :(

1 Answer 1


Yes you can write your own APEX rest API which will accept the Id List as parameter and ten can perform DML operation on them. This is how your class will look like which accept the parameter and perform ction on them.

global with sharing class MyRestResource {

    global static String doPost(String name,
        String phone, String website) {
        Account account = new Account();
        account.Name = name;
        account.phone = phone;
        account.website = website;
        insert account;
        return account.Id;

Apex REST Basic Code Sample

  • 1
    Thank you for that code snippet, I copied it into a dummy Apex class and then used that as a template for merging contacts (referenced the DML merge documentation as well)
    – GPP
    Mar 23, 2018 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.