How amitastreait/how-to-call-salesforce-api-from-lightning-component works
This repository documents a Salesforce Lightning example for querying the Salesforce REST API from a component. The user clicks a button; the Aura controller delegates to its helper, which invokes an Apex action. Apex obtains the user session through a Visualforce page, makes an Account query, and returns the response for display. The README also mentions Connected App and Named Credentials as an alternative, but this tutorial implements the Visualforce approach. Source excerpts were unavailable, so relationships are based on the README.
Main entry points: ApiCallLightningComponent.txt Apex callout · MakeApiCallHelper Aura helper · MAKEAPICALLCOMPONENT.html Callout component · MakeApiCallController Aura controller
Components 9
Lightning UI
- Lightning application
Call API From Lightning Component/App - Callout component
Call API From Lightning Component/MAKEAPICALLCOMPONENT.html - Aura controller
Call API From Lightning Component/MakeApiCallController - Aura helper
Call API From Lightning Component/MakeApiCallHelper - Query response
Call API From Lightning Component/MakeApiCallHelper
Apex Callout
- Apex callout
Call API From Lightning Component/ApiCallLightningComponent.txt
Salesforce Services
- Session ID page
- Salesforce REST API
Other components
- Lightning user
Connections 9
- Lightning user → Callout component: clicks button
README.md - Lightning application → Callout component: hosts
README.md - Callout component → Aura controller: routes action
README.md - Aura controller → Aura helper: delegates click
README.md - Aura helper → Apex callout: invokes action
README.md - Apex callout → Session ID page: reads session
README.md - Apex callout → Salesforce REST API: queries Accounts
README.md - Apex callout → Aura helper: returns response
README.md - Aura helper → Query response: parses response
README.md