function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VijayNiVijayNi 

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 .

Thanks,
Vijay.
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.

http://blogs.developerforce.com/tech-pubs/2011/10/salesforce-apis-what-they-are-when-to-use-them.html

This is an interesting blog and may answer your question very well.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_quickstart_intro.htm

API described in Salesforce documentation above.
SOAP API
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.

REST API
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.  

Thanks.
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

SOAP vs REST

 

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)
-Standardized
-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.