# amitastreait/how-to-call-salesforce-api-from-lightning-component architecture

> Architecture diagram of the GitHub repository amitastreait/how-to-call-salesforce-api-from-lightning-component, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amitastreait/how-to-call-salesforce-api-from-lightning-component
- Repository: https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component

## Overview

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: [`Call API From Lightning Component/ApiCallLightningComponent.txt`](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/ApiCallLightningComponent.txt) (Apex callout), [`Call API From Lightning Component/MakeApiCallHelper`](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallHelper) (Aura helper), [`Call API From Lightning Component/MAKEAPICALLCOMPONENT.html`](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MAKEAPICALLCOMPONENT.html) (Callout component), [`Call API From Lightning Component/MakeApiCallController`](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallController) (Aura controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lightning["Lightning UI"]
  node_app["Lightning application"]
  node_component["Callout component"]
  node_controller["Aura controller"]
  node_helper["Aura helper"]
  node_response["Query response"]
end

subgraph group_apex["Apex Callout"]
  node_apex["Apex callout"]
end

subgraph group_salesforce["Salesforce Services"]
  node_vf["Session ID page"]
  node_rest["Salesforce REST API"]
end

node_user(("Lightning user"))

node_user -->|"clicks button"| node_component
node_app -->|"hosts"| node_component
node_component -->|"routes action"| node_controller
node_controller -->|"delegates click"| node_helper
node_helper -->|"invokes action"| node_apex
node_apex -->|"reads session"| node_vf
node_apex -->|"queries Accounts"| node_rest
node_apex -->|"returns response"| node_helper
node_helper -->|"parses response"| node_response

click node_app "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/App"
click node_component "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MAKEAPICALLCOMPONENT.html"
click node_controller "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallController"
click node_helper "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallHelper"
click node_apex "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/ApiCallLightningComponent.txt"
click node_response "https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallHelper"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_component,node_controller,node_helper,node_response,node_user toneBlue
class node_apex toneAmber
class node_vf,node_rest toneMint
```

## Components

### Lightning UI

- [Lightning application](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/App): `Call API From Lightning Component/App`
- [Callout component](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MAKEAPICALLCOMPONENT.html): `Call API From Lightning Component/MAKEAPICALLCOMPONENT.html`
- [Aura controller](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallController): `Call API From Lightning Component/MakeApiCallController`
- [Aura helper](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallHelper): `Call API From Lightning Component/MakeApiCallHelper`
- [Query response](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/MakeApiCallHelper): `Call API From Lightning Component/MakeApiCallHelper`

### Apex Callout

- [Apex callout](https://github.com/amitastreait/how-to-call-salesforce-api-from-lightning-component/blob/master/Call%20API%20From%20Lightning%20Component/ApiCallLightningComponent.txt): `Call API From Lightning Component/ApiCallLightningComponent.txt`

### Salesforce Services

- **Session ID page**
- **Salesforce REST API**

### Other components

- **Lightning user**

## Connections

- Lightning user → Callout component: clicks button (evidence: `README.md`)
- Lightning application → Callout component: hosts (evidence: `README.md`)
- Callout component → Aura controller: routes action (evidence: `README.md`)
- Aura controller → Aura helper: delegates click (evidence: `README.md`)
- Aura helper → Apex callout: invokes action (evidence: `README.md`)
- Apex callout → Session ID page: reads session (evidence: `README.md`)
- Apex callout → Salesforce REST API: queries Accounts (evidence: `README.md`)
- Apex callout → Aura helper: returns response (evidence: `README.md`)
- Aura helper → Query response: parses response (evidence: `README.md`)
