ONE DAY SALE

Free Salesforce Developers Tutorials >

Chapter 13 - API >

REST API Part 7

REST API Part 7

What You’ll Learn


S2 Labs

Explanation Of API Callout Code

An API callout code involves various classes:

  1. HTTP class: This class object we create, to send API requests using send method.
  2. 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.

salesforce-developer

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

Your email address will not be published. Required fields are marked *