Google drive api 谷歌驱动API消息;超出未经认证使用的每日限制。”;从Salesforce查看文件时
我创建了一个服务帐户,获得了json配置文件,并使用它请求访问令牌。响应正常,我收到令牌。当我使用它上传文件时,一切正常,但当我试图查看文件夹中的文件时,它返回错误消息 超出未经验证使用的每日限制。继续使用需要 报名 我的服务帐户只需要访问自己的文件,它不访问任何其他用户的文件。 查看文件的代码(现在我尝试调试响应):Google drive api 谷歌驱动API消息;超出未经认证使用的每日限制。”;从Salesforce查看文件时,google-drive-api,salesforce,apex,Google Drive Api,Salesforce,Apex,我创建了一个服务帐户,获得了json配置文件,并使用它请求访问令牌。响应正常,我收到令牌。当我使用它上传文件时,一切正常,但当我试图查看文件夹中的文件时,它返回错误消息 超出未经验证使用的每日限制。继续使用需要 报名 我的服务帐户只需要访问自己的文件,它不访问任何其他用户的文件。 查看文件的代码(现在我尝试调试响应): public List getFilesList(){ Http=newhttp(); HttpRequest req=新的HttpRequest(); 请求setMethod(
public List getFilesList(){
Http=newhttp();
HttpRequest req=新的HttpRequest();
请求setMethod('GET');
请求setEndpoint('https://www.googleapis.com/drive/v2/files?accessToken=“+accessToken”);
HttpResponse resp=http.send(req);
系统调试(resp);
调试(resp.getBody());
返回null;
}
有关错误,请尝试在API下的Google developer控制台中检查与API键关联的项目。示例:https://console.developers.google.com/project//apiui/api
。确保Google+API的状态设置为“开”
基于此,该错误意味着您尚未设置GoogleAPI控制台项目
https://console.developers.google.com/project//apiui/api
。确保Google+API的状态设置为“开”
基于此,该错误意味着您尚未设置GoogleAPI控制台项目
希望这有帮助 我发现了问题所在。我在url地址中发送访问令牌,而不是在标头中。最后,我是这样做的:
public List<String> getFilesList() {
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('https://www.googleapis.com/drive/v2/files);
req.setHeader('Authorization', 'Bearer '+accessToken);
HttpResponse resp = http.send(req);
return null;
}
public List getFilesList(){
Http=newhttp();
HttpRequest req=新的HttpRequest();
请求setMethod('GET');
请求setEndpoint('https://www.googleapis.com/drive/v2/files);
请求setHeader('授权','承载'+accessToken);
HttpResponse resp=http.send(req);
返回null;
}
我发现了问题所在。我在url地址中发送访问令牌,而不是在标头中。最后,我是这样做的:
public List<String> getFilesList() {
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('https://www.googleapis.com/drive/v2/files);
req.setHeader('Authorization', 'Bearer '+accessToken);
HttpResponse resp = http.send(req);
return null;
}
public List getFilesList(){
Http=newhttp();
HttpRequest req=新的HttpRequest();
请求setMethod('GET');
请求setEndpoint('https://www.googleapis.com/drive/v2/files);
请求setHeader('授权','承载'+accessToken);
HttpResponse resp=http.send(req);
返回null;
}