Et
Et
5. Tooling API
• Purpose: Interact with Salesforce metadata programmatically.
• Key Features:
o Access metadata like Apex classes, triggers, and Visualforce pages.
o Perform operations like retrieving or deploying code.
• Example Endpoint:
/services/data/v58.0/tooling/sobjects/ApexClass
• Use Case:
o Building a CI/CD pipeline to deploy Apex code.
6. Composite REST API
• Purpose: Combine multiple requests into a single API call.
• Key Features:
o Reduces API call limits.
o Supports batch processing and dependencies between operations.
• Example Endpoint:
/services/data/v58.0/composite
• Use Case:
o Creating an Account and its related Contacts in a single API request.
https://yourInstance.salesforce.com/services/data/v58.0/sobjects/Account
• Example:
@RestResource(urlMapping='/LoanEligibility/*')
@HttpPost
return 'Eligible';
-H "Content-Type: application/json" \
-d '{"customerId":"12345","income":75000}' \
https://yourInstance.salesforce.com/services/apexrest/LoanEligibility/
@HttpPost
}
• Testing:
o Use Postman or cURL to simulate requests.
req.setEndpoint('https://abc.com/animals’);
req.setMethod('GET');
req.setHeader(‘Content-Type’, ‘application/json;charset=UTF-8’);
req.setBody(‘{“name”:”Elon Musk”}’);
• Testing:
o Use Salesforce Developer Console to invoke the Apex method.
Real-World Use Cases
Inbound REST API Examples
1. Customer Feedback Submission:
o An external form captures feedback and sends it to Salesforce for storage under a
custom object.
2. Third-Party E-Commerce Platform Sync:
o Shopify sends order details to Salesforce for fulfillment tracking.
Outbound REST API Examples
1. Send Notifications to Messaging Apps:
o Salesforce sends lead updates to Slack or Microsoft Teams.
2. Sync Data with ERP System:
o Salesforce sends invoices to an ERP system for processing.
Pro Tip: Always follow Salesforce API limits to ensure smooth functioning of your integrations. For large-
scale integrations, consider using Bulk API or Streaming API.