In EGL, you can use the following Interface part to access a third-party REST service.
interface IRest function invokeGet(reqURL string in) returns(string) {@getRest {uriTemplate="{reqURL}"}}; function invokePost(reqURL string in, representation string in) returns(string) {@postRest {uriTemplate="{reqURL}"}}; function invokePut(reqURL string in, representation string in) returns(string) {@putRest {uriTemplate="{reqURL}"}}; function invokeDelete(reqURL string in, representation string in) returns(string) {@deleteRest {uriTemplate="{reqURL}"}}; end
By using this Interface part as is, you do not have to write one. However, the work required to code the service-invocation statement is different.
myVar IRest?; myResource String = JSONLib.convertToJson(myRec); call myVar.invokePost("http://www.example.com", myResource) returning to myCallbackfunction;
myString STRING: myVar IRest?; myResource String = JSONLib.convertToJson(myRec); myString = myVar.invokePost("http://www.example.com", myResource);
myVar IRest? {@RESTService {baseURI="http://www.example.com"}; myResource String = JSONLib.convertToJSON(myRec); call myVar.invokePost("", myResource) returning to myCallbackfunction;
function invokeDelete(reqURL string in) returns(string) {@deleteRest {uriTemplate="{reqURL}"}};