REST and SOAP are 2 different approaches to online data transmission. Specifically, both define how to build application programming interfaces (APIs), which allow data to be communicated between web applications.

Representational state transfer(REST) is a set of architectural principles. Simple object access protocol (SOAP) is an official protocol maintained by the World Wide Web Consortium (W3C). The main difference is that SOAP is a protocol while REST is not. Typically, an API will adhere to either REST or SOAP, depending on the use case and preferences of the developer.

Many legacy systems may still adhere to SOAP, while REST came later and is often viewed as a faster alternative in web-based scenarios. REST is a set of guidelines that offers flexible implementation, whereas SOAP is a protocol with specific requirements like XML messaging.

REST APIs are lightweight, making them ideal for newer contexts like the Internet of Things (IoT), mobile application development, and serverless computing. SOAP web services offer built-in security and transaction compliance that align with many enterprise needs, but that also makes them heavier. Additionally, many public APIs, like the Google Maps API, follow the REST guidelines.

SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer.
SOAP is a protocol which was designed with a specification. It includes a WSDL file which has the required information on what the web service does in addition to the location of the web service. REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being Client Server, Stateless, Cacheable, Layered System, Uniform Interface.
It is functional-driven, means that data here is available as services It is data-driven, meaning that data is available as resources.
SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern. REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern.
It has WS-security (Enterprise-level security) with SSL support. It supports HTTPS and SSL (Secure Sockets Layer)
SOAP is by default stateless, but it is possible to make this API stateful. It is stateful, i.e. no server-side sessions occur.
SOAP uses service interfaces to expose its functionality to client applications. REST use Uniform Service locators to access to the components on the hardware device.
SOAP requires more bandwidth for its usage. Since SOAP Messages contain a lot of information inside it. REST does not need much bandwidth when requests are sent to the server. REST messages mostly just consist of JSON messages.
SOAP can only work with XML format. REST permits different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is JSON.