0% found this document useful (0 votes)
7 views4 pages

API Call Methods in Salesforce

The document outlines various methods for making API calls in Salesforce, including Integration Procedures, JavaScript (Fetch API & Async/Await), and Apex. Integration Procedures simplify server-side processes without Apex code, while JavaScript allows direct API calls from LWC components but may require additional settings due to CSP. Apex provides more control and complexity handling for API calls, making it suitable for advanced operations.

Uploaded by

hitarth.raval
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

API Call Methods in Salesforce

The document outlines various methods for making API calls in Salesforce, including Integration Procedures, JavaScript (Fetch API & Async/Await), and Apex. Integration Procedures simplify server-side processes without Apex code, while JavaScript allows direct API calls from LWC components but may require additional settings due to CSP. Apex provides more control and complexity handling for API calls, making it suitable for advanced operations.

Uploaded by

hitarth.raval
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SALESFORCE ENTHUSIASTS

NUMBER OF WAYS
TO MAKE API
CALLS IN
SALESFORCE
USING INTEGRATION PROCEDURES (IP) 02

integration Procedures are declarative tools in Salesforce that allow you to create server-side processes
without writing Apex code. They are best suited for complex, multi-step operations and are often used in
Omnistudio applications.

Advantages of Integration Procedures:


Reduces complexity by avoiding custom Apex code
Supports branching and conditional logic
Ideal for server-side processing

Salesforce Enthusiasts
USING JAVASCRIPT (FETCH API & ASYNC/AWAIT) 03

JavaScript can be used to call external APIs directly from an LWC component using native browser
methods. However, due to Salesforce’s Content Security Policy (CSP), direct API calls often require
remote site settings or named credentials.

Explanation of Fetch API with Async/Await:


fetch() initiates the HTTP request and returns a Promise.
await pauses the function execution until the promise
resolves or rejects.
[Link]() parses the JSON response body.
Error handling is straightforward using try/catch blocks.
Advantages of JavaScript Fetch:
Asynchronous handling with promises or async/await
Direct and simple for lightweight operations
No need for server-side processing

Salesforce Enthusiasts
USING APEX 03

Apex provides server-side capabilities to make API calls in Salesforce. You can create an Apex
class with a callout method and expose it via AuraEnabled methods for LWC.

Advantages of Apex:
Greater control over callouts
Can handle complex logic and transformations
Supports error handling and retries

Salesforce Enthusiasts

You might also like