-
-
Save damimolo/37d0d0938aa821e004a2 to your computer and use it in GitHub Desktop.
Google Cloud Datastore Error The library is this: https://github.com/google/google-api-php-client throw Google_Service_Exception at src/Google/Http/REST.php on line 75 Error calling POST https://www.googleapis.com/datastore/v1beta2/datasets/btspprt/lookup: (400) app s~btspprt cannot access app btspprt's data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* The library is this: https://github.com/google/google-api-php-client | |
* | |
* | |
* throw Google_Service_Exception at src/Google/Http/REST.php on line 75 | |
* | |
* Error calling POST https://www.googleapis.com/datastore/v1beta2/datasets/btspprt/lookup: (400) app s~btspprt cannot access app btspprt's data | |
* | |
*/ | |
$creds = new Google_Auth_AssertionCredentials('__user__@developer.gserviceaccount.com', array( | |
'https://www.googleapis.com/auth/datastore', | |
'https://www.googleapis.com/auth/userinfo.email' | |
), file_get_contents('__public_key__-privatekey.p12')); | |
$client = new Google_Client(); | |
$client->setAssertionCredentials($creds); | |
$datastore = new Google_Service_Datastore($client); | |
$AppId = '__application_id__'; | |
$partitionId = new Google_Service_Datastore_PartitionId(); | |
$partitionId->setDatasetId($AppId); | |
$partitionId->setNamespace('User'); | |
$path = new Google_Service_Datastore_KeyPathElement(); | |
$path->setId('__entity_id_as_integer__'); | |
$path->setKind('User'); | |
$key = new Google_Service_Datastore_Key(); | |
$key->setPartitionId($partitionId); | |
$key->setPath($path); | |
$keys = array($key); | |
$readOptions = new Google_Service_Datastore_ReadOptions(); | |
$readOptions->setReadConsistency("DEFAULT"); | |
$lookupRequest = new Google_Service_Datastore_LookupRequest(); | |
$lookupRequest->setKeys($keys); | |
$lookupRequest->setReadOptions($readOptions); | |
$datastore->datasets->lookup($AppId, $lookupRequest); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment