[英]Public API access not working with gapi.client for datastore javascript API
I am new to google cloud datastore. 我是Google云数据存储的新手。 I am currently trying to query my dataset using the API key which I created at developers console.
我目前正在尝试使用在开发人员控制台创建的API密钥查询数据集。 Below is my code snippet to call the datastore API (I am using gapi.client):
下面是调用数据存储区API的代码段(我正在使用gapi.client):
gapi.client.setApiKey('API_KEY');
gapi.client.load('datastore', 'v1beta2').then(function() {
console.log('loaded.');
gapi.client.datastore.datasets.runQuery({'datasetId' : 'myProjectId','gqlQuery': { 'queryString': 'select * from locationReport'}}).then(function(resp) {
console.log(resp.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);}
);
});
This returns me following response: 返回以下响应:
Response headers: 响应头:
HTTP/1.1 401 Unauthorized
Vary: Origin
Vary: X-Origin
WWW-Authenticate: Bearer realm="https://accounts.google.com/"
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Date: Mon, 22 Jun 2015 14:49:06 GMT
Expires: Mon, 22 Jun 2015 14:49:06 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=1
Transfer-Encoding: chunked
Response body: 响应主体:
Login Required
要求登录
Though it is mentioned here that one can access the data using public api, I am still not able to do so. 尽管这里提到可以使用公共api访问数据,但我仍然不能这样做。
Please help me with this. 请帮我解决一下这个。 Let me know whether is it possible or is there any other way to retrieve data from datastore without requiring user permission like OAuth
让我知道是否有可能或是否有其他方法可以从数据存储中检索数据,而无需像OAuth这样的用户权限
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.