When to use REST & When to use SOAP ?

Most of the sfdc beginners came across this question "When should I use REST & When to use SOAP API" suspecting-emoticon-design-30573285, but not all of us end up getting the appropriate answer.Many of us start writing REST API's because they're widely used.

I'll provide you some practical Scenarios for using REST & SOAP API's.As a sfdc Developer :

I will use REST when : -

1.) When my Data is in the form of XML 

    or JSON   

2.) Browser-based

or Mobile app 
Integration.Since JSON is Light weight (provides inbuilt support with Javascript & Browser) so uses less bandwidth.

3.) Less Preferred where Security  

  is the biggest Concern. eg- Banking Apps. Because REST API only provides Http SSL Encryption .

4.) When Custom Error handling is to done.Since there's no built in Error handling Feature in REST.


Screenshot from 2017-04-03 19:07:06

6.) REST services are Cacheable.

This feature is very useful, Say if you want to share with your friend a Mobile details that you are planning to purchase, what you need to do is just share the link which is a REST call. 31163A0400000578-3442108-image-a-27_1455189872679

Screenshot from 2017-04-03 18:23:03


I will use SOAP when : -

1.) When my Data is of the form


2.) Used in Real-time client applications that update small numbers of records at a time.Avoid it in case of low Bandwidths as XML (Heavy-weight).

3.) Preferred where Security   

 is the biggest Concern. Example - Banking Apps & industry standard softwares like TIBCO, IBM . Because SOAP API  provides both Http SSL Encryption & WS Security Encryption.

4.) When built in Error handling is required.If there is a problem with SOAP request sent.SOAP response will contain error information of it.


Screenshot from 2017-04-03 19:07:45

6.) SOAP services are not cacheable as there is a need to explicitly form a SOAP request so that server can understand.

Say if you like to purchase any mobile and want to share details of that mobile with your friend in this case you need to explicitly tell your friend to go to xyz url and then press this button etc. which is painful.



  1. Thanks for your article ....this is one of the very confusing question with no clear answer....but I am very much clear now

Comments are closed.

Popular Salesforce Blogs