如何解决 System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings for Google docs API [英] How to solve System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings for Google docs API
问题描述
我要了
System.CalloutException:未授权端点,请检查设置->安全->远程站点设置.端点 = docs.googleapis.com/v1/documents
System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = docs.googleapis.com/v1/documents
在驱动器中创建文档时出错.
error while creating document in drive.
这是我的代码
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setEndpoint('https://docs.googleapis.com/v1/documents');
req.setHeader('Authorization', 'Bearer '+accessToken);
req.setHeader('content-type', 'application/json');
req.setTimeout(60*1000);
String body='{"title": "NewDocument"}';
req.setBody(body);
Http http = new Http();
HttpResponse res = http.send(req);
你能帮我解决这个错误吗.
Can you please help me to solve this error.
推荐答案
该错误为您提供了解决此问题的步骤.
The error gives you the steps to solve this.
https://help.salesforce.com/articleView?id=sf.configuring_remoteproxy.htm&type=5
您需要按照上述文章中的步骤告诉 Salesforce 可以调用该 URL.
You need to tell Salesforce it's OK to make a call to that URL by following the steps in the article above.
这篇关于如何解决 System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings for Google docs API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!