7

当我查询时,/mycollections?ql=Select * where name='dfsdfsdfsdfsdfsdf'我得到

{
  "action" : "get",
  "application" : "859e6180-de8a-11e4-9360-f1aabbc15f58",
  "params" : {
    "ql" : [ "Select * where name='dfsdfsdfsdfsdfsdf'" ]
  },
  "path" : "/mycollections",
  "uri" : "http://localhost:8080/myorg/myapp/mycollections",
  "entities" : [ {
    "uuid" : "2ff8961a-dea8-11e4-996b-63ce373ace35",
    "type" : "mycollection",
    "name" : "dfsdfsdfsdfsdfsdf",
    "created" : 1428577466865,
    "modified" : 1428577466865,
    "metadata" : {
      "path" : "/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35",
      "connections" : {
        "relations" : "/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations"
      }
    }
  } ],
  "timestamp" : 1428589309204,
  "duration" : 53,
  "organization" : "myorg",
  "applicationName" : "myapp",
  "count" : 1
}

现在,如果我查询/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations,我会得到第二个实体

{
  "action" : "get",
  "application" : "859e6180-de8a-11e4-9360-f1aabbc15f58",
  "params" : { },
  "path" : "/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations",
  "uri" : "http://localhost:8080/myorg/myapp/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations",
  "entities" : [ {
    "uuid" : "56a1185a-dec1-11e4-9ac0-e9343f86b604",
    "type" : "secondcollection",
    "name" : "coucou",
    "created" : 1428588269141,
    "modified" : 1428588269141,
    "metadata" : {
      "connecting" : {
        "relations" : "/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations/56a1185a-dec1-11e4-9ac0-e9343f86b604/connecting/relations"
      },
      "path" : "/mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations/56a1185a-dec1-11e4-9ac0-e9343f86b604"
    }
  } ],
  "timestamp" : 1428589668542,
  "duration" : 51,
  "organization" : "myorg",
  "applicationName" : "myapp"
}

我想要的是,不是为我提供相关实体 Usergrid 的路径,而是直接将其嵌套在第一个 JSON 答案中,这样我只需要发出一个 http 请求而不是两个。

4

2 回答 2

1

你不能。Usergrid 不是这样设计的。您需要编写一个额外的包装器休息端点来模拟一个响应。

于 2015-05-21T13:17:06.227 回答
0

不确定您使用的是什么数据库。如果您使用的是像 mongo 这样的文档数据库,那么您可以编写一个 node.js 脚本来执行此操作。Apigee 有 volvo.js 检查是否可以编写脚本。

于 2015-04-23T15:26:18.760 回答