Using Usergrid, how do I get related objects nested in one json, and not just a link to them

When I request /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 request /mycollections/2ff8961a-dea8-11e4-996b-63ce373ace35/relations , I get a second object

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

I want instead of giving me the path of the associated object, Usergrid directly embeds it in the first JSON response, so I only need to make one HTTP request instead of two.

+7
apigee usergrid
source share
2 answers

You can not. Weatherdrid is not created in this way. You need to write an additional shell breakpoint to simulate a single response.

+1
source share

Not sure which database you are using. If you are using a db file similar to mongo, you can write node.js scripts to perform this manipulation. Apigee has a volvo.js check to see if it is possible to execute scripts.

0
source share

All Articles