Newer Version Available
Making API Calls
You can’t make API calls from client-side code. Make API calls, including Salesforce API calls, from server-side
controllers instead.
The framework uses Content Security Policy (CSP) to control the source of content that can be loaded on a page. Lightning apps are served from a different domain than Salesforce APIs so the CSP doesn’t allow API calls from JavaScript code.
For information about making API calls from server-side controllers, see Making API Calls from Apex.