Google app engine 400来自GAE云端点的响应

Google app engine 400来自GAE云端点的响应,google-app-engine,google-cloud-endpoints,Google App Engine,Google Cloud Endpoints,我正在尝试对我的GAE云端点执行以下api调用: gapi.client.myapp.foo.update({ "value": "foobar", "key": "keyvaluefromlistoperation" }).execute(function(resp) { console.log(resp); }); 其回应如下: [ { "error": { "code": 400, "message": "Bad Request", "data": [

我正在尝试对我的GAE云端点执行以下api调用:

gapi.client.myapp.foo.update({
  "value": "foobar",
  "key": "keyvaluefromlistoperation"
}).execute(function(resp) {
  console.log(resp);
});
其回应如下:

[
 {
  "error": {
   "code": 400,
   "message": "Bad Request",
   "data": [
    {
     "domain": "usageLimits",
     "reason": "keyInvalid",
     "message": "Bad Request"
    }
   ]
  },
  "id": "gapiRpc"
 }
]
注意,在这个调用之前,我已经进行了身份验证,插入了几个foo对象,然后调用list将它们返回到客户端。api的explorer更新调用工作正常,运行下面的jQuery代码段也工作正常。有什么建议吗?或者我只是在实验性的虫子之地

var token = gapi.auth.getToken();
$.ajax({
  type:"POST",
  beforeSend: function (request) {
    request.setRequestHeader("Content-Type","application/json");
    request.setRequestHeader("Authorization", token.token_type+" "+token.access_token);
  },
  url: "https://myappid.appspot.com/_ah/api/myapp/v1/foo/update",
  data:JSON.stringify({
     "value": "foobar",
     "key": "keyvaluefromlistoperation"
  }),
  processData: false,
  dataType: "json",
  success: function(msg) {
    console.log(msg);
  },
  failure: function(msg) {
     console.log(msg);
  }
});
以下是Java代码:

@Api(
    name = "myapp",
    description = "This is the myapp rest interface",
    scopes = {"https://www.googleapis.com/auth/userinfo.email"},
    version = "v1",
    clientIds = {Ids.WEB_CLIENT_ID}
)
public class FooV1 {

    private static PersistenceManager getPersistenceManager() {
        return PMF.get().getPersistenceManager();
    }

    @ApiMethod(
            name = "foo.update", 
            httpMethod = HttpMethod.POST
    )
    public Foo update(Foo foo, User user) throws OAuthRequestException, IOException, UnauthorizedUpdateException {
        PersistenceManager pm = PMF.get().getPersistenceManager();

        if (user != null) {
            try {
                Foo f = pm.getObjectById(Foo.class, foo.getId());
                if ( Security.isUpdateAuthorized(f, user) ) {
                    if( foo.getValue() != null ) f.setValue(foo.getValue());
                } else {
                    throw new UnauthorizedUpdateException("");
                }
            } finally {
                pm.close();
            }
        } else {
            throw new OAuthRequestException("Invalid user.");
        }

        return foo;
    }
}

我也有同样的问题。显然,一旦部署到GAE,就不能将“key”用作字段。本地运行良好。

此错误是持续发生还是间歇性发生?持续发生了近两天。每次请求
gapi.client.myapp.foo.update
?如果没有,百分比是多少?使用客户端包“gapi.client.myapp.foo.update”的每次更新都会失败。100%通过1)将uid参数“key”更改为“id”,然后2)更改版本号,我终于能够解决所有问题。如果我这样做的话,我的部署就会失败。我已经能够在更新了参数名(id)的新版本(v2)上正常工作。