+ Start a Discussion

Which API to be used for Lead Management System to send qualified Leads as Accounts, Contacts and Opportunities to Salesforce

An external Lead Management system will send qualified Leads as Accounts, Contacts and Opportunities to Salesforce. Would you recommend the external system to integrate directly with the SFDC SOAP/REST API? Would you expose an Apex Webservice? What other integration pattern would your recommend and why? 
AnudeepAnudeep (Salesforce Developers) 
Hi Gaurav, 

You can either expose your class as a REST Service or SOAP Service. While making your Apex class available as a REST web service is straightforward it really depends on your external system as to which method it supports

To learn more refer to the documentation Apex Web Services

Note that you can create multiple objects at once when you expose your class. See example below
//Apex Class

global with sharing class AccountManager{
    global static Account getAccount(){
        RestRequest request = RestContext.request;
        String accountId = request.requestURI.substringBetween('Accounts/','/contacts');
        Account objAccount = [SELECT Id,Name,(SELECT Id,Name FROM Contacts) FROM Account WHERE Id = :accountId LIMIT 1];
        return objAccount;

Let me know if this helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!