2013-07-08 63 views

回答

1
var clientId = '<YOUR_CLIENT_ID>'; 
var datasetId = '<YOUR_DATASET_ID>'; 
var scopes = 'https://www.googleapis.com/auth/datastore \ 
https://www.googleapis.com/auth/userinfo.email'; 
gapi.auth.authorize(
    {client_id: clientId, scope: scopes, immediate: false}, 
    function(authResult) { 
     if (authResult && !authResult.error) { 
     gapi.client.load('datastore', 'v1beta1', function() { 
      gapi.client.datastore.datasets.beginTransaction({ 
      'datasetId': datasetId 
      }).execute(function(resp) { 
      console.log(resp); 
      }); 
     }); 
     } 
    }); 

请记住,自谷歌云存储没有ACL支持,JavaScript客户端将具有完全的读/写访问整个数据集。

+0

自从你回答1年前以来,这个变化了吗?基本上不可能在JavaScript客户端库的这个API上找到文档。 – mattdlockyer

+0

@mattdlockyer它看起来好像您现在可以通过JSON API提交到数据存储。 https://cloud.google.com/datastore/docs/apis/v1beta2/datasets/commit – wprater

+0

非常感谢您的链接! – mattdlockyer

相关问题