ApexCallouts
ApexCallouts copied to clipboard
Use `Url.getOrgDomainUrl()`
Switch the RestApi class to start using Url.getOrgDomainUrl().toExternalForm(). From the docs:
- "getOrgDomainUrl() always returns the same domain for your org, regardless of context. Use this method to build links to record URLs that work both in Lightning Experience and in Salesforce Classic, or as the domain when making API calls to your org."
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_url.htm