Salesforce
PDII · Question #370
Universal Containers develops a Salesforce application that requires frequent interaction with an external REST API. To avoid duplicating code and improve maintainability, how should they implement…
The correct answer is B. Create a reusable Apex class for the API integration and invoke it from the relevant Apex classes. See the full explanation below for the reasoning.
Question
Universal Containers develops a Salesforce application that requires frequent interaction with an external REST API. To avoid duplicating code and improve maintainability, how should they implement the API integration for code reuse?
Options
- AStore the API integration code as a static resource and reference it in each Apex class.
- BCreate a reusable Apex class for the API integration and invoke it from the relevant Apex classes.
- CInclude the API integration code directly in each Apex class that requires it.
- DUse a separate Apex class for each API endpoint to encapsulate the integration logic.
How the community answered
(20 responses)- A5% (1)
- B75% (15)
- C15% (3)
- D5% (1)
Community Discussion
No community discussion yet for this question.