Create REST client resource pragmatically

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Create REST client resource pragmatically

#1

Postby Segi » Thu Aug 31, 2017 4:16 pm

Is there way to create and execute a REST resource pragmatically without creating a REST resource to back it up ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Fri Sep 01, 2017 6:46 am

Yes using the services.rest API, see http://www.ebasetech.com/ebase/doc/Rest ... amming.htm.

Here's an example:

Code: Select all

var headers =  {
	  "timezone" : "xxx"
};
               
var uri = "http://xxx.com/api/controllerApi/getTimeZone";
try
{
	var response = services.rest.get(uri, headers, null);
	if(response.isSuccess());
	{
          // Parse the JSON response object
         var tz = JSON.parse(response.getBody());
	}
	else
	{
         ...handle errors
	}
}
catch (e)
{
   .. an I/O Error can be thrown in some circumstances
}
0 x


Who is online

Users browsing this forum: No registered users and 3 guests