REST API Part 7
Chapter Topics
- APIs in Salesforce
- Need of API in Salesforce
- Languages Used in creating APIs
- How Communication Happens in APIs
- Types of APIs in Salesforce
- REST API Part 1
- REST API Part 2
- REST API Part 3
- REST API Part 4
- REST API Part 5
- REST API Part 6
- REST API Part 7
- REST API Part 8
- REST API Part 9
- SOAP API Part 1
- SOAP API Part 2
- SOAP API Part 3
- SOAP API Part 4
- SOAP API Part 5
- Metadata API in Salesforce
Explanation Of API Callout Code
An API callout code involves various classes:
- HTTP class: This class object we create, to send API requests using send method.
- HTTPRequest Class: This class object we create to set various request-related information using various methods:
- setHeader(key, value): Used to set headers like authorization code, content type, etc.
- setBody(str): Used to set information we want to send in the post method.
- setMethod(methodName): Used to set the HTTP method(‘GET’, ‘POST’, ‘PUT’, ‘PATCH’, or ‘DELETE’, which we are using to call API.
Remote Site Settings
Whenever we call an external API through the Visualforce page, custom button, Javascript code, or directly through Apex callout, we first need to add that API endpoint to Remote Site Settings.
Remote Site Setting is used to avoid accessing malicious websites from Salesforce.com. You can find Remote Site Settings in Setup.
Next TopicNeed more support?
Get a head start with our FREE study notes!
Learn more and get all the answers you need at zero cost. Improve your skills using our detailed notes prepared by industry experts to help you excel.