Activity Forums Salesforce® Discussions Where we have to use REST API and where we have to use SOAP API in Salesforce?

  • Where we have to use REST API and where we have to use SOAP API in Salesforce?

    Posted by Pooja on March 6, 2020 at 2:22 pm

    Where we have to use REST API and where we have to use SOAP API in Salesforce?

    Deepak replied 4 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Deepak

    Member
    March 6, 2020 at 2:24 pm

    Hi Pooja,

    What is SOAP ?

    The Simple Object Access Protocol (SOAP) is an attempt to define a standard for creating web service APIs. It is a pattern, a web service architecture, which specifies the basic rules to be considered while designing web service platforms. It typically uses HTTP as a layer 7 protocol, although this is not mandatory. The SOAP message itself consists of an envelope, inside of which are the SOAP headers and body, the actual information we want to send. It is based on the standard XML format, designed especially to transport and store structured data. SOAP may also refer to the format of the XML that the envelope uses.

    SOAP is a mature standard and is heavily used in many systems, but it does not use many of the functionality build in HTTP. While some consider it slow, it provides a heavy set of functionality which is a necessity in many cases. It might now be the best solution for browser-based clients, due to its custom format.

    What is REST ?

    The Representational State Transfer (REST) is another architectural pattern (resource-oriented), an alternative to SOAP. Unlike SOAP, RESTful applications use the HTTP build-in headers (with a variety of media-types) to carry meta information and use the GET, POST, PUT and DELETE verbs to perform CRUD operations. REST is resource-oriented and uses clean URLs (or RESTful URLs).

    For example :

    http://www.developingthefuture.com/index.php?page=foo

    becomes

    http://www.developingthefuture.com/foo

    This kind of URLs syntax greatly improves both visibility and usability. It doesn’t use any query strings, and it also provides certain SEO benefits (the crawlers just love plain text). The body of the REST message can be XML, JSON or any other format, although JSON is usually the preferred choice. On the other hand, you can’t use JSON with SOAP. Or at least not entirely, because SOAP uses XML by definition for it’s envelope. It should also mentioned that REST is, by design, protocol-agnostic, although it is usually used with HTTP.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos