+ Start a Discussion

Soap vs api when to use

Hi  Team,

Can you help me when to use rest API and SOAP API when we want to integrate with external system .

We have a requirement where  salesforce data in our system needs to be updated in the external system an ERP appliaction as well .

ANUTEJANUTEJ (Salesforce Developers) 
Hi Vijay,

Basically, we use soap when we want to handle XML type of data and REST when we use JSON as REST only supports JSON and not XML.

SOAP API and REST API are two commonly used API's to expose your data from force.com platform to other platforms(JAVA ,.NET ,etc) or to allow external application to invoke Apex methods.


This is an interesting blog and may answer your question very well.

API described in Salesforce documentation above.
Supports data in the form of XML only
Requires WSDL for the integration
Use SOAP API in any language that supports Web services.
It is a standard protocol and needs more bandwidth and resources.

Supports both XML and JSON format
Preferred for mobile and web apps since JSON being Lighter the app runs smoother and faster
It is more of an architectural system and requires less bandwidth and resources.

You can also use Apex SOAP and REST Web services to expose data from platform or allow an external application to invoke Apex methods.

>> http://www.proquestit.com/techies/salesforce-soap-vs-restful-web-services/

The above shows a comparison of rest and soap.

As stated in the above link for comparison:

REST uses JSON. JSON is easier to parse than XML. Thus, REST uses less memory and CPU    
SOAP uses only XML. XML is harder to parse. SOAP uses more memory and CPU
REST is best for social media based Applications    
SOAP is best for Enterprise web applications, banking transactions…
So depending on the usecase and the data you are parsing you would be choosing REST or SOAP.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

ANUTEJANUTEJ (Salesforce Developers) 
Additionally, I would suggest you to check this below link :

>> https://developer.salesforce.com/forums/?id=906F00000009kVeIAI
Malika Pathak 9Malika Pathak 9

Hi a.vijay

find the below solution



The term web API generally refers to both sides of computer systems communicating over a network: the API services offered by a server, as well as the API offered by the client such as a web browser.
The server-side portion of the web API is a programmatic interface to a defined request-response message system and is typically referred to as the Web Service. There are several design models for web services, but the two most dominant are SOAP and REST.
SOAP provides the following advantages when compared to REST:
-Language, platform, and transport-independent (REST requires the use of HTTP)     
-Works well in distributed enterprise environments (REST assumes direct point-to-point communication)
-Provides significant pre-build extensibility in the form of the WS* standards
-Built-in error handling
-Automation when used with certain language products
REST is easier to use for the most part and is more flexible. It has the following advantages when compared to SOAP:
-Uses easy to understand standards like swagger and OpenAPI Specification 3.0
Smaller learning curve
-Efficient (SOAP uses XML for all messages, REST mostly uses smaller message formats like JSON)
-Fast (no extensive processing required)


if you find this helpful please mark it as the best answer.