What is the difference between SOAP and REST APIs. Can someone please explain with the scenarios which one I need to pick for which type of scenarios?
First and foremost difference is the protocol that both APIs use. Then it mostly depends on your use cases in general and your Integration sources. Many times you will need to use SOAP over RESTful and vice-versa. E.g., if you want to build quicker integrations for web/mobile with smaller learning curve, REST may be your option. But if you are looking for more enterprise wide distributed integrations, SOAP may be your option.
However to get more details on the APIs available with the platform, take a look at the documentation here, you will get the details you need. Below are excerpt from the link, refer the link for more details.
Use SOAP API to create, retrieve, update or delete records, such as accounts, leads, and custom objects. With more than 20 different calls, SOAP API also allows you to maintain passwords, perform searches, and much more. Use SOAP API in any language that supports Web services.
REST API provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it’s an excellent choice of technology for use with mobile applications and web projects. For certain projects, you may want to use REST API with other Salesforce REST APIs. (more on documentation)
Here’s another link that you can refer for more details on the differences between these two APIs
SOAP is a standard communication protocol system that permits processes using different operating systems like Linux and Windows to communicate via HTTP and its XML.SOAP API has an official standard because it is a protocol.
REST is basically an architectural style of the web services that work as a channel of communication between different computers or systems on the internet. REST API has no has no official standard at all because it is an architectural style.REST was designed specifically for working with components such as media components, files, or even objects on a particular hardware device.
When to use REST and when to use SOAP
REST services should be used in the following instances:
Limited resources and bandwidth
Ease of coding
SOAP should be used in the following instances
- Asynchronous processing and subsequent invocation
- A Formal means of communication
- Stateful operations