Link URL of remote site in Apex class?

I have a webservice class that will be in a managed package and distributed to multiple clients. The class has a variable with the hard-coded value of the server it clicks on.

Problem: the server will be different for each client, so a hard-coded value will not work.

I realized that each client would have to add its server to its remote site settings, the easiest way would be to capture the correct URL from their settings. Is it possible? Or is there another β€œright” way to do this? Thanks

+5
source share
1 answer

The best way to find configuration values ​​is to use Apex User Preferences . To programmatically configure remote site settings, you can use the metadata API .

+10
source

All Articles