Declarative callouts versus Apex HTTP callouts
Key Takeaway
Choose the tool based on the API. External Services and the HTTP Callout action make callouts without code, but you should use Apex for a SOAP-based web service.
A callout is a request that Salesforce sends to an external system's API. Salesforce offers two ways to make one. The declarative way uses External Services or the HTTP Callout action in Flow Builder, so app builders can make callouts with zero lines of code. Both tools turn an external API's operations into reusable invocable actions. The programmatic way uses built-in Apex HTTP classes, where a developer builds the request in code.
External Services
External Services starts from an API spec. You register an OpenAPI 2.0 or OpenAPI 3.0 schema in JSON or YAML format, and the operations in that schema automatically become invocable actions in these places:
- Flow Builder
- Orchestrator
- Einstein bots
- OmniStudio Assets
- Apex
The operations also become available as custom agent actions.
External Services can only consume an external web service that is a REST-based API. It works best when that REST-based service has its API spec available in OpenAPI format.
An API spec must be valid under the OpenAPI specification and must also meet requirements specific to External Services. Registration can fail if the API spec exceeds the file size limit or the limit on the total number of objects or actions.
Getting an API spec may not be declarative. If the API provider hasn't shared one, someone must create it: you, a developer, or a schema builder tool like Swagger Editor.
External Services is available in Lightning Experience in these editions:
- Enterprise
- Performance
- Unlimited
- Developer