Page 1 of 1

REST service results that use 2 more REST services.

Posted: Tue May 22, 2012 9:48 pm
by benzarod

Hi Guys,
Basically I have a REST service that return a JSON array.
For each entry I need to call another REST service and show the result in the same grid.

So, If I don't link the results array to the Grid, works perfect but shows only 1 result.

If I link the results array to the grid, shows all the results but I don't know how to do to call the other services.

I hope you guys understand me.

Thanks
Rodrigo


REST service results that use 2 more REST services.

Posted: Tue May 22, 2012 11:40 pm
by maxkatz

To invoke any service from JavaScript, you can do this:

code
serviceInstanceName.execute({});
/code
http://help.tiggzi.com/documentation/...

But you need to get data, so above won't exactly work. Another approach is to create a Generic Service (https://getsatisfaction.com/tiggzi/to...) or even just create the service yourself and invoke (you will see an example here: http://help.tiggzi.com/documentation/... ). You will get data back from the service and will need to add it to the current element (insert into DOM) manually.

A few things to keep in mind. Services will be invoked asynchronously and there is a limit to how many Ajax requests a browser will do.

Hope this helps...


REST service results that use 2 more REST services.

Posted: Tue May 22, 2012 11:47 pm
by benzarod

Thanks Max,

For some reason the last link is an 404.


REST service results that use 2 more REST services.

Posted: Tue May 22, 2012 11:53 pm
by benzarod

Ok, I got it, remove the extra ).


REST service results that use 2 more REST services.

Posted: Tue May 22, 2012 11:58 pm
by benzarod

It is not clear for me when I need to invoke the service I have created.
Basically, I need to call it for each specific value the SERV1 returned.

Example:

SERV1 -- MLA123
MLA124
MLA125

I need to call SERV2 for MLA123 show the result in the same grid and do the same with the other 2 entries.


REST service results that use 2 more REST services.

Posted: Wed May 23, 2012 12:45 am
by maxkatz

You could call the other service in mapping.


REST service results that use 2 more REST services.

Posted: Wed May 23, 2012 5:45 pm
by benzarod

Thanks Max
I'm calling the other service in response mapping in under the grid object.
via JS, serviceInstanceName.execute({});

From what I can see, the service executed well, but don't map the output to the elements.
Any suggestion?


REST service results that use 2 more REST services.

Posted: Wed May 23, 2012 6:12 pm
by maxkatz

You can only map one service to a page. Once you get data back from the second service, you need to add the data/markup with JavaScript.