0

我试图理解

https://developers.google.com/apis-explorer/#p/datastore/v1beta1/datastore.datasets.blindWrite

但我总是得到

503 Service Unavailable

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "backendError",
    "message": "Backend Error"
   }
  ],
  "code": 503,
  "message": "Backend Error"
 }
}

您能否提供一个尽可能简单的示例,我可以粘贴以验证它是否确实有效?我尝试过这样的事情。

{
 "mutation": {
  "insertAutoId": [
   {
    "key": {
     "path": [
      {
       "kind": "person",
       "name": "gert"
      }
     ]
    }
   }
  ]
 }
}
4

1 回答 1

2

假设您遵循文档中描述的前两个激活流程之一。并且最近创建了项目,App Engine 应用程序应该已经与您的项目相关联。

你需要:

  • 点击Authorize your request using OAuth 2.0
  • 选中https://www.googleapis.com/auth/userinfo.email范围
  • https://www.googleapis.com/auth/datastore在下面添加Add additional scopes (optional)
  • 单击Authorize并授予权限
  • 指定datasetId参数(与您的相同project-id
  • 如果键是完整的(种类 w/名称或 id) ,则使用insertorupsert代替。insertAutoId

例子:

POST https://www.googleapis.com/datastore/v1beta1/datasets/my-dataset-id/blindWrite...

Content-Type:  application/json
Authorization:  Bearer ...
X-JavaScript-User-Agent:  Google APIs Explorer

{
 "mutation": {
  "insert": [
   {
    "key": {
     "path": [
      {
       "kind": "Foo",
       "name": "iamfoo"
      }
     ]
    }
   }
  ]
 }
}

200 OK

{
 "kind": "datastore#blindWriteResponse",
 "mutationResult": {
  "indexUpdates": 1
 }
}
于 2013-06-12T11:28:17.613 回答