Interface RestResource


public interface RestResource
  • Method Summary

    Modifier and Type Method Description
    java.lang.String call()
    Calls the default endpoint specified on the REST Web Services Resource.
    java.lang.String call​(java.lang.String endpointName)
    Calls the endpoint specified by endpointName on the REST Web Services Resource
  • Method Details

    • call

      java.lang.String call() throws com.ebasetech.xi.exceptions.FormRuntimeException
      Calls the default endpoint specified on the REST Web Services Resource.

      The call will invoke the HTTP request method configured in the REST resource. e.g If the resource method is configured as GET, then a HTTP GET request is called.

      The following rest HTTP methods support a request field

      • PUT
      • POST
      • PATCH
      The following rest HTTP methods support a response field
      • GET
      • PUT
      • POST
      • PATCH
      • OPTIONS

      Further documentation.

      Javascript example:

       // call the REST web service
       try {
         resources.GET_BOOKS.call();
         var allBooks = JSON.parse(fields.MyBooksResponse.value);
         //process allBooks
         ....
       }
       catch (e)
       {
         log(e.javaException.message);
       }
       
      Returns:
      HTTP code status from the REST call
      Throws:
      com.ebasetech.xi.exceptions.FormRuntimeException - if any other error occurs during execution
      Since:
      V5.1
      See Also:
      call(String)
    • call

      java.lang.String call​(java.lang.String endpointName) throws com.ebasetech.xi.exceptions.FormRuntimeException
      Calls the endpoint specified by endpointName on the REST Web Services Resource

      The call will invoke the HTTP request method configured in the rest resource. e.g If the resource method is configured as GET, then a HTTP GET request is called.

      The following rest HTTP methods support a request field

      • PUT
      • POST
      • PATCH
      The following REST HTTP methods support a response field
      • GET
      • PUT
      • POST
      • PATCH
      • OPTIONS

      Further documentation.

      Javascript example:

       // call the rest
       try {
         fields.BookId.value = "16-148410-0";
         resources.BOOKS.call("getBookByISBN");
         var allBooks = JSON.parse(fields.BookResponse.value);
         //process book
         ....
       }
       catch (e if e.javaException instanceof com.ebasetech.xi.exceptions.RestRuntimeException)
       {
         log(e.javaException.message);
       }
       
      Parameters:
      endpointName - the endpoint to be called
      Returns:
      HTTP code status from the REST call
      Throws:
      com.ebasetech.xi.exceptions.FormRuntimeException - if any other error occurs during execution
      Since:
      V5.1
      See Also:
      call()