Рет қаралды 2,169
In this video,
I'll guide you through the process of setting up external credentials and named credentials in Salesforce, focusing on configuring authentication and making secure callouts to an external API, specifically for the Research Guardian integration.
Topics Covered:
Overview of the use case and business requirements for Max Environmental Science Institute (MESI)
Step-by-step guide to configuring external credentials
1. Setting up named credentials in Salesforce
2. Handling custom authentication headers
3. Writing Apex code for making secure API callouts
4. Debugging common issues like unauthorised headers
Whether you're working on a Salesforce superbadge or looking to enhance your Salesforce integration skills, this tutorial will provide you with the essential steps and tips to successfully configure and manage external and named credentials for secure API integrations.
Code :
public with sharing class ResearchServiceController {
public static Integer processEquipmentsRequest() {
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Research_Guardian/equipments');
req.setMethod('GET');
HttpResponse response = new Http().send(req);
if (response.getStatusCode() == 200) {
String responseBody = response.getBody();
System.debug('Available Equipments: ' + responseBody);
} else {
System.debug('Callout failed with status code: ' + response.getStatusCode());
}
return response.getStatusCode();
}
}
Connect with Me:
Instagram: ankitkpunjabi
LinkedIn: / ankitkumar007
Hashtags:
#Salesforce #Superbadge #NamedCredentials #ExternalCredentials #APIIntegration #ResearchGuardian #SalesforceDeveloper #MuleSoft #Apex