Interface Services

All Known Implementing Classes:
ServicesImpl

public interface Services
  • Method Details

    • getRest

      RestServices getRest()
      Returns the REST services that supports REST based operations.
      Since:
      5.1
    • getPushNotification

      PushNotification getPushNotification()
    • getDate

      DateServices getDate()
      Returns the date services containing methods associated with dates.
      Since:
      5.1
    • getDatabase

      DatabaseServices getDatabase()
      Returns the database services containing methods associated with databases.
      Since:
      5.2
    • getEncryption

      EncryptionServices getEncryption()
      Returns the encryption services containing methods associated with Ebase encryption.
      Since:
      5.1
    • getFile

      FileServices getFile()
      Returns the file services containing methods associated with system files.
      Since:
      5.1
    • getLdap

      LdapServices getLdap()
      Returns the LDAP services containing methods that provide authentication and search methods against an LDAP Registry.
      Since:
      5.1
    • getPostcodeAnywhere

      PostcodeAnywhereServices getPostcodeAnywhere()
      Returns the postcode anywhere services containing methods to access the PostcodeAnywhere service.
      Since:
      5.1
    • getScheduler

      SchedulerServices getScheduler()
      Returns the scheduler services containing methods that enable Scheduled Tasks to be started from a form, workflow job or Integration Service.
      Since:
      5.1
    • getVelocity

      VelocityServices getVelocity()
      Returns the Velocity services containing methods to invoke a Velocity template.
      Since:
      5.1
    • getSecurity

      ServicesSecurity getSecurity()
      Returns the services security containing any security implementations required by Services.
      Since:
      5.1
    • getErrors

      Errors getErrors()
      The Errors is a server side JavaScript object that contains functions that allows the creation of customizable error handling functionality specifically returned from the server, for example a 404 HTTP Not Found error. The error handlers are created using a description string and an error code. The errors are as follows:
      • HttpRequestError - This is typically used to create HTTP response failure errors, for example the server responds with a 400 Bad Request code
      • HttpAuthorisationError - This should be used when generating Authentication errors, for example the server responds with a 401 Unauthorized code
      • HttpNotFoundError - This should be used when generating not found errors, for example the server responds with a 404 Not Found code
      • HttpServerError - This should be used when generating generic server errors, for example the server responds with a 500 Server Error code
      • HttpUnknownError - This should be used when generating an unknown or unrecognized error, for example the HTTP code is not recognized

      Further documentation.

      JavaScript example:

       // call Users REST API
       function callUsersAPI()
       {
         var response = services.rest.get("http://example.com/rest/users");
         if(!response.isSuccess()) {
           switch(response.code) {
             case 401:
                // Send an email stating that the service is authorized
                fields.unauthorizedError.value = response.body;
                resources.sysAdmin.sendMail();
                throw services.errors.createAuthorisationError("Unauthorized", response.code);
             
             default:
                throw services.errors.createRequestError("Request error", response.code);
         }
         //process result
       }
      
       

      Returns:
      Errors an interface containing functions to create a specific HttpError errors
      Since:
      v5.13.0