I want to execute a call to Lightning Platform REST API in Anonymous window. When I am writing the following:
String sfURL = URL.getSalesforceBaseUrl().toExternalForm();
I am getting the following error:
method does not exist or incorrect signature void getSalesforceBaseUrl() from the type String
I have checked and the sandbox URL is specified in the Remote Site Settings, since this is a preliminary condition. I do not know if this is regarding the fact that I use the Anonymous Window to execute the code directly. Is there any restriction for this?