I tried, and below is my code, I donβt know what went wrong.
$http({
method: 'POST',
headers:'{"gqlQuery": {"queryString": "select * from culture" }}',
url: 'https://datastore.googleapis.com/v1/projects/nammaooru-3630e:runQuery?fields=batch%2Cquery&key=[myapikey]'
}).then(function successCallback(response) {
alert("Success"+response);
}, function errorCallback(response) {
alert("Error"+response);
});
Received error in angular Request **
https://datastore.googleapis.com/v1/projects/nammaooru-3630e:runQuery?fields=batch%2Cquery&key=[apikey]
Failed to load resource: the server responded with a status of 401 ()
Got an error while trying in Postman
URL : https:
Method : POST
{
"error": {
"code": 401,
"message": "The request does not have valid authentication credentials.",
"status": "UNAUTHENTICATED"
}
}
But I got a response from the Google developer site
https://cloud.google.com/datastore/docs/reference/rest/v1/projects/runQuery#http-request
{
"batch": {
"entityResultType": "FULL",
"entityResults": [
{
"entity": {
"key": {
"partitionId": {
"projectId": "nammaooru-3630e"
},
"path": [
{
"kind": "culture",
"id": "5629499534213120"
}
]
},
"properties": {
"types": {
"stringValue": "",
"excludeFromIndexes": true
},
"images": {
"stringValue": "",
"excludeFromIndexes": true
},
"bname": {
"stringValue": "Kangeyam Kalai"
},
"date": {
"timestampValue": "2017-01-14T12:44:56.933Z"
},
"title": {
"stringValue": ""
},
"description": {
"stringValue": "Coimbatore Kongu nadu region",
"excludeFromIndexes": true
}
}
},
"cursor": "Ci8SKWoRc35uYW1tYW9vcnUtMzYzMGVyFAsSB2N1bHR1cmUYgICAgICAgAoMGAAgAA==",
"version": "1484398012256000"
}
],
"endCursor": "Ci8SKWoRc35uYW1tYW9vcnUtMzYzMGVyFAsSB2N1bHR1cmUYgICAgICAgAoMGAAgAA==",
"moreResults": "NO_MORE_RESULTS"
},
"query": {
"kind": [
{
"name": "culture"
}
]
}
}