INT-Q10Conceptual IntermediateIntegration & data#security#integration

How do you call an external REST API securely from Salesforce?

Your confidence:Not rated

Model answer

  • Create an External Credential with the authentication protocol (for example OAuth 2.0 client credentials or JWT) and a principal (named for system calls, per-user if the target must know the user).
  • Create a Named Credential with the base URL that uses it.
  • Grant access with a permission set mapped to the principal.
  • In Apex, call callout:My_API/path; from Flow, use External Services generated from the OpenAPI spec.
  • Set timeouts; don't call out after uncommitted DML (use Queueable or platform events); retry only idempotent calls; log failures with correlation IDs.
  • No secrets in code, custom settings or custom metadata visible to users.

โœ” Key points to hit

โœ– Red-flag answers

  • Storing tokens in custom settings
  • Hardcoding endpoints
  • Callouts in triggers

โ†ช Follow-ups

What's the difference between named and per-user principals?

Named: one identity for all calls. Per-user: each user authenticates to the target, so actions and permissions are per person.

Do you still need Remote Site Settings?

Not when calling through Named Credentials.