Posts

Showing posts from October, 2021

Salesforce REST API: How to Expose Apex Classes as REST API Endpoint - POST

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community This article is in continuation of my previous article  How to Expose Apex Classes as REST Web Services - GET Operations  where I have explained how to implement a GET Operation.   In this article, we will look into the detailed implementation of exposing Apex class as REST Web Service offering a POST operation to delete records from Salesforce Object(s).    To start with the demo, I have set up some of the data in Accounts Object (Standard Object) which has Invoices Record as its Child   Step-1 & 2:  I have added an Account  “acr001”  in Accounts Object Step-3 & 4:  I have added a few  “Invoice Records”  which are associated with Customer  “acr001”   Step-5 & 6:  If we click any of the Invoice Records, we can see the respective details. We have a couple of important fields  “Invoice Number”, “Invoic

Salesforce REST API: How to Expose Apex Classes as REST API Endpoint - GET Operations

Image
Looking for Salesforce Training & HandsOn Projects? Trailblazer Profile  |  LinkedIn  |  Salesforce Blog  |  Facebook  |  Youtube Channel  |  WhatsApp Community Salesforce allows developers to expose Apex classes and methods so that external applications can access your code and your application through the REST architecture.   Calls to Apex REST classes count against the organization's API governor limits. All standard Apex governor limits apply to Apex REST classes. For example, the maximum request or response size is  6 MB for synchronous Apex or 12 MB for asynchronous Apex . Apex REST supports the following authentication mechanisms: OAuth 2.0 Session ID   In this article, we will look into the detailed implementation of exposing Apex class as REST Web Service offering a GET operation to read data from Salesforce Object(s).   To start with the demo, I have set up some of the data in Accounts Object which we will be using to query as part of the  GET  request.   Step-1 &