Class APITool


  • public class APITool
    extends RESTTool
    Simplicite(R) API toolbox
    • Constructor Summary

      Constructors 
      Constructor Description
      APITool​(java.lang.String baseURL, java.lang.String login, java.lang.String password, java.lang.String encoding)
      Constructor for remote application
    • Method Summary

      Modifier and Type Method Description
      org.json.JSONObject action​(java.lang.String object, java.lang.String rowId, java.lang.String action, java.util.Map<java.lang.String,​java.lang.String> values)
      Call action on one object record or on all current object records
      org.json.JSONObject count​(java.lang.String object)
      Count object records without filters
      org.json.JSONObject count​(java.lang.String object, java.lang.String filters)
      Count object records with query string
      org.json.JSONObject count​(java.lang.String object, org.json.JSONObject filters)
      Count object records with filters
      org.json.JSONObject create​(java.lang.String object, org.json.JSONObject fields)
      Create object record
      org.json.JSONObject crosstab​(java.lang.String object, java.lang.String rowId, java.lang.String crosstab, boolean cubes, java.util.Map<java.lang.String,​java.lang.String> values)
      Generate a pivot table
      org.json.JSONObject del​(java.lang.String object, java.lang.String rowId)
      Delete object record, alias to delete (Rhino friendly naming)
      org.json.JSONObject delete​(java.lang.String object, java.lang.String rowId)
      Delete object record
      org.json.JSONObject get​(java.lang.String object, java.lang.String rowId)
      Get object record
      org.json.JSONObject get​(java.lang.String object, java.lang.String rowId, boolean copy)
      Get object record
      org.json.JSONObject getApplication​(boolean texts)
      Get application data
      java.lang.String getAuthToken()
      Get auth token
      long getAuthTokenExpiry()
      Get auth token expiry time
      java.lang.String getBaseURL()
      Get base URL
      java.lang.String getEncoding()
      Get encoding
      org.json.JSONObject getSession()
      Get session data
      java.lang.String getSessionCookies()
      Get cookies
      org.json.JSONArray indexSearch​(java.lang.String query)
      Search in global index
      boolean isAuthTokenExpired()
      Is auth token expired?
      void login​(boolean force)
      Login
      void logout()
      Logout
      org.json.JSONObject metadata​(java.lang.String object, int context)
      Get object metadata without parameters
      org.json.JSONObject metadata​(java.lang.String object, int context, java.lang.String params)
      Get object metadata with parameters
      org.json.JSONArray search​(java.lang.String object, int page)
      Search object records without filters
      org.json.JSONArray search​(java.lang.String object, int page, java.lang.String filters)
      Search object records with query string
      org.json.JSONArray search​(java.lang.String object, int page, org.json.JSONObject filters)
      Search object records with filters
      org.json.JSONObject update​(java.lang.String object, java.lang.String rowId, org.json.JSONObject fields)
      Update object record
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • APITool

        public APITool​(java.lang.String baseURL,
                       java.lang.String login,
                       java.lang.String password,
                       java.lang.String encoding)
                throws java.lang.Exception
        Constructor for remote application
        Parameters:
        baseURL - Base URL
        login - Login
        password - Password
        encoding - Encoding to use
        Throws:
        java.lang.Exception
    • Method Detail

      • getBaseURL

        public java.lang.String getBaseURL()
        Get base URL
      • getEncoding

        public java.lang.String getEncoding()
        Get encoding
      • getAuthToken

        public java.lang.String getAuthToken()
        Get auth token
      • getAuthTokenExpiry

        public long getAuthTokenExpiry()
        Get auth token expiry time
      • isAuthTokenExpired

        public boolean isAuthTokenExpired()
        Is auth token expired?
      • getSessionCookies

        public java.lang.String getSessionCookies()
        Get cookies
      • login

        public void login​(boolean force)
                   throws java.lang.Exception
        Login
        Parameters:
        force - Force?
        Throws:
        java.lang.Exception
      • logout

        public void logout()
                    throws java.lang.Exception
        Logout
        Throws:
        java.lang.Exception
      • getApplication

        public org.json.JSONObject getApplication​(boolean texts)
                                           throws java.lang.Exception
        Get application data
        Throws:
        java.lang.Exception
      • getSession

        public org.json.JSONObject getSession()
                                       throws java.lang.Exception
        Get session data
        Throws:
        java.lang.Exception
      • indexSearch

        public org.json.JSONArray indexSearch​(java.lang.String query)
                                       throws java.lang.Exception
        Search in global index
        Parameters:
        query - Query
        Throws:
        java.lang.Exception
      • metadata

        public org.json.JSONObject metadata​(java.lang.String object,
                                            int context,
                                            java.lang.String params)
                                     throws java.lang.Exception
        Get object metadata with parameters
        Parameters:
        object - Object name
        context - Context
        params - Optional parameters as query string
        Throws:
        java.lang.Exception
      • metadata

        public org.json.JSONObject metadata​(java.lang.String object,
                                            int context)
                                     throws java.lang.Exception
        Get object metadata without parameters
        Parameters:
        object - Object name
        context - Context
        Throws:
        java.lang.Exception
      • count

        public org.json.JSONObject count​(java.lang.String object,
                                         org.json.JSONObject filters)
                                  throws java.lang.Exception
        Count object records with filters
        Parameters:
        object - Object name
        filters - Filters
        Throws:
        java.lang.Exception
      • count

        public org.json.JSONObject count​(java.lang.String object,
                                         java.lang.String filters)
                                  throws java.lang.Exception
        Count object records with query string
        Parameters:
        object - Object name
        filters - Filters query string
        Throws:
        java.lang.Exception
      • count

        public org.json.JSONObject count​(java.lang.String object)
                                  throws java.lang.Exception
        Count object records without filters
        Parameters:
        object - Object name
        Throws:
        java.lang.Exception
      • search

        public org.json.JSONArray search​(java.lang.String object,
                                         int page,
                                         org.json.JSONObject filters)
                                  throws java.lang.Exception
        Search object records with filters
        Parameters:
        object - Object name
        page - Page (or -1 for no pagination)
        filters - Filters
        Throws:
        java.lang.Exception
      • search

        public org.json.JSONArray search​(java.lang.String object,
                                         int page,
                                         java.lang.String filters)
                                  throws java.lang.Exception
        Search object records with query string
        Parameters:
        object - Object name
        page - Page (or -1 for no pagination)
        filters - Filters query string
        Throws:
        java.lang.Exception
      • search

        public org.json.JSONArray search​(java.lang.String object,
                                         int page)
                                  throws java.lang.Exception
        Search object records without filters
        Parameters:
        object - Object name
        page - Page (or -1 for no pagination)
        Throws:
        java.lang.Exception
      • create

        public org.json.JSONObject create​(java.lang.String object,
                                          org.json.JSONObject fields)
                                   throws java.lang.Exception
        Create object record
        Parameters:
        object - Object name
        fields - Fields
        Throws:
        java.lang.Exception
      • get

        public org.json.JSONObject get​(java.lang.String object,
                                       java.lang.String rowId,
                                       boolean copy)
                                throws java.lang.Exception
        Get object record
        Parameters:
        object - Object name
        rowId - Row ID
        copy - Get for copy?
        Throws:
        java.lang.Exception
      • get

        public org.json.JSONObject get​(java.lang.String object,
                                       java.lang.String rowId)
                                throws java.lang.Exception
        Get object record
        Parameters:
        object - Object name
        rowId - Row ID
        Throws:
        java.lang.Exception
      • action

        public org.json.JSONObject action​(java.lang.String object,
                                          java.lang.String rowId,
                                          java.lang.String action,
                                          java.util.Map<java.lang.String,​java.lang.String> values)
                                   throws java.lang.Exception
        Call action on one object record or on all current object records
        Parameters:
        object - Object name
        rowId - Optional row ID
        action - Action name
        values - Action values
        Throws:
        java.lang.Exception
      • crosstab

        public org.json.JSONObject crosstab​(java.lang.String object,
                                            java.lang.String rowId,
                                            java.lang.String crosstab,
                                            boolean cubes,
                                            java.util.Map<java.lang.String,​java.lang.String> values)
                                     throws java.lang.Exception
        Generate a pivot table
        Parameters:
        object - Object name
        rowId - Optional row ID
        crosstab - Pivot table name
        cubes - Data as cubes?
        Throws:
        java.lang.Exception
      • update

        public org.json.JSONObject update​(java.lang.String object,
                                          java.lang.String rowId,
                                          org.json.JSONObject fields)
                                   throws java.lang.Exception
        Update object record
        Parameters:
        object - Object
        rowId - row ID
        fields - Fields
        Throws:
        java.lang.Exception
      • del

        public org.json.JSONObject del​(java.lang.String object,
                                       java.lang.String rowId)
                                throws java.lang.Exception
        Delete object record, alias to delete (Rhino friendly naming)
        Parameters:
        object - Object
        rowId - row ID
        Throws:
        java.lang.Exception
      • delete

        public org.json.JSONObject delete​(java.lang.String object,
                                          java.lang.String rowId)
                                   throws java.lang.Exception
        Delete object record
        Parameters:
        object - Object
        rowId - row ID
        Throws:
        java.lang.Exception