How to invoke a restful webservice in total.js

355 views
Skip to first unread message

gaurav...@googlemail.com

unread,
Sep 11, 2014, 7:06:15 AM9/11/14
to tot...@googlegroups.com
Hi,

I am trying to evaluate total.js as the MVC framework for our project. Is there a direct library available using which we can invoke a WEB API and parse the response?Basically my portal will be a client to an external restful web service.

I know we have a module node-rest-client which we can use but do we have something available in total.js so that I don't have to download a module?

Thanks & Regards
Shashi

Peter Širka

unread,
Sep 11, 2014, 7:19:18 AM9/11/14
to tot...@googlegroups.com, gaurav...@googlemail.com
Hi Sashi,
yes. Total.js supports some functions for requesting.


Utils.request('http://www.totaljs.com/test.json', ['get'], function(err, data, status, headers) {
   console
.log(JSON.parse(data));
});

PS: Utils/utils is a global variable.
Thanks.

Peter Širka

unread,
Sep 11, 2014, 7:23:52 AM9/11/14
to tot...@googlegroups.com, gaurav...@googlemail.com
Or post some data:

Utils.request('http://hroch486.icpf.cas.cz/cgi-bin/echo.pl', ['json', 'put'], { name: 'OK' }, function(err, data) {
    console
.log(err, data);
});

Thanks.
Reply all
Reply to author
Forward
0 new messages