For a personal project, I'm trying to retrieve Validation Rules from objects to display them inside a Visualforce page.
For this I'm using the excellent Tooling API wrapper from Andrew Fawcett, but when making calls to it I get errors about the call being made from an unauthorized endpoint.
IO Exception: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://c.na40.visual.force.com/services/Soap/T/32.0
If I add the endpoint to the security settings the calls run without issues.
Two questions here:
- If I wanted to distribute something using this through the AppExchange, should I have to include instructions to add the endpoint in the remote site settings? Or is there a way to automate this setting during installation?
- To my understanding, several tools (Like Mavensmate and Atom, Sublime and VSCode extensions) make use of the Tooling API and they never ask for security settings in the target instance, how can they achieve that?
I'm fairly sure I'm missing something though.
Here's some sample code that triggers this, I'm using a dev instance for my tests.
TApi = new ToolingApi();
ToolingAPIWSDL.QueryResult qrVRs = TApi.query('select Name, TableEnumOrId from ValidationRule');
Thanks in advance.