Owen, thanks for the quick reply. You are correct, all of the data is there, but some transformation has taken place that I didn't expect, I didn't want to reference anything yet, just dump the response to a file. It looks as though the RestClient traversed the entire tree recursively to build a map of maps to convert the response to a string. I need the response in a Jason file to be processed down stream.
On Sat, Jun 13, 2015 at 5:34 PM Owen Rubel <oru...@gmail.com> wrote: > Looks like you merely lost the ROOT 'type' in your referencing; everything > else is there. This shouldn't be a problem. Just make sure you are > referencing it properly. > > Owen Rubel > 415-971-0976 > oru...@gmail.com > > On Sat, Jun 13, 2015 at 3:18 PM, Kurt Andrews <kurt.w.andr...@gmail.com> > wrote: > >> I'm trying to do something I though was very simple, but now appears more >> complicated. I wanted to make an api call and store the JSON response in a >> file. here is the code: >> >> def onSiteAg = new RESTClient("$endpoint".toString()) >> def response = onSiteAg.get( >> requestContentType: JSON, >> path: "$path", >> headers: ["X-OS-APIKey": "$apiKey".toString(), >> "X-OS-Hash": "qxZira2KCZjF0j62hkvYmtvFFkw=", >> "X-OS-userKey": "$userKey".toString(), >> "X-OS-TimeStamp": "$ts".toString()]) >> >> println response.data.toString() >> >> The response I get back isn't what I expected: >> >> [[children:[[children:[[children:[[children:[[children:[[created:2015-05-07 >> 17:05:31.012675, field_id:100286, modified:2015-05-07 17:05:31.012675, >> name:Yorkville Mothers East, type:Field], [created:2015-05-07 >> 17:05:31.125785, field_id:100287, modified:2015-05-07 17:05:31.125785, >> name:Yorkville NW, type:Field], [created:2015-05-07 17:05:31.187275, >> field_id:100288, modified:2015-05-07 17:05:31.187275, name:Yorkville >> Canton, type:Field], [created:2015-05-07 17:05:31.247555, field_id:100289, >> modified:2015-05-07 17:05:31.247555, name:Yorkville SE, type:Field], >> [created:2015-05-07 17:05:31.306773, field_id:100290, modified:2015-05-07 >> 17:05:31.306773, name:Yorkville Rod, type:Field]], created:2015-05-07 >> 17:05:30.995382, farm_id:32248, modified:2015-05-07 17:05:30.995382, >> name:Yorkville, type:Farm]], created:2015-05-07 17:05:30.98609, >> modified:2015-05-07 17:05:30.98609, name:N C IL, profile_id:12023, >> type:Customer]], created:2015-05-07 17:05:30.981996, modified:2015-05-07 >> 17:05:30.981996, name:Growmark Location, profile_id:12022, type:Location]], >> created:2015-05-07 17:05:30.976894, modified:2015-05-07 17:05:30.976894, >> name:API Member Company, profile_id:12021, type:Dealer]], >> created:2015-05-05 19:31:41.792483, modified:2015-05-05 19:31:41.792483, >> name:FS AIS, profile_id:1, type:Site Owner]] >> >> I was expecting this: >> >> [{"type": "Site Owner", "name": "FS AIS", "profile_id": "1", "created": >> "2015-05-05 19:31:41.792483", "modified": "2015-05-05 19:31:41.792483", >> "children":[{"type": "Dealer", "name": "API Member Company", "profile_id": >> "12021", "created": "2015-05-07 17:05:30.976894", "modified": "2015-05-07 >> 17:05:30.976894", "children":[{"type": "Location", "name": "Growmark >> Location", "profile_id": "12022", "created": "2015-05-07 17:05:30.981996", >> "modified": "2015-05-07 17:05:30.981996", "children":[{"type": "Customer", >> "name": "N C IL", "profile_id": "12023", "created": "2015-05-07 >> 17:05:30.98609", "modified": "2015-05-07 17:05:30.98609", >> "children":[{"type": "Farm", "name": "Yorkville", "farm_id": "32248", >> "created": "2015-05-07 17:05:30.995382", "modified": "2015-05-07 >> 17:05:30.995382", "children":[{"type": "Field", "name": "Yorkville Mothers >> East", "field_id": "100286", "created": "2015-05-07 17:05:31.012675", >> "modified": "2015-05-07 17:05:31.012675" }, { "type": "Field", "name": >> "Yorkville NW", "field_id": "100287", "created": "2015-05-07 >> 17:05:31.125785", "modified": "2015-05-07 17:05:31.125785" }, { "type": >> "Field", "name": "Yorkville Canton", "field_id": "100288", "created": >> "2015-05-07 17:05:31.187275", "modified": "2015-05-07 17:05:31.187275" }, { >> "type": "Field", "name": "Yorkville SE", "field_id": "100289", "created": >> "2015-05-07 17:05:31.247555", "modified": "2015-05-07 17:05:31.247555" }, { >> "type": "Field", "name": "Yorkville Rod", "field_id": "100290", "created": >> "2015-05-07 17:05:31.306773", "modified": "2015-05-07 >> 17:05:31.306773"}]}]}]}]}]}] >> >> What I received seems reversed some how, and it looks like all of the JSON >> object syntax has been removed. >> >> Can someone please explain what's happening, and how I can fix it so that I >> can dump the JSON response from the server to a file? >> >> Thanks and regards, >> >> Kurt >> >> >> >