7

When I query /mycollections?ql=Select * where name='dfsdfsdfsdfsdfsdf' I get

{
  "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
}

Now if I query /mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations I get the second entity

{
  "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"
}

What I want is that instead of providing me the path of the related entity Usergrid directly nest it in the first JSON answer so that I only need to make a single http request instead of two.

Jan Moritz
  • 1,957
  • 4
  • 18
  • 30

2 Answers2

1

You cannot. Usergrid is not designed in that way. You need to write an extra wrapper rest endpoint to simulate one response.

Fatih S.
  • 300
  • 2
  • 8
0

Not sure what DB you are using. If you are using document db like mongo then you can write a node.js scripts to do this manipulation. Apigee has volvo.js check is it possible to do scripting.

Chandru
  • 854
  • 8
  • 15