Class EspoApiClient


  • public class EspoApiClient
    extends java.lang.Object
    A client for the EspoCRM API
    Since:
    1.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String apiKey  
      protected java.lang.String password  
      protected java.lang.String secretKey  
      protected java.lang.String url  
      protected java.lang.String username  
    • Constructor Summary

      Constructors 
      Constructor Description
      EspoApiClient()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> java.lang.String request​(Method method, java.lang.String action, T payload)
      Send a POST, PUT or DELETE request to EspoCRM
      java.lang.String requestGet​(java.lang.String action, Params params)
      Send a GET request to EspoCRM
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • url

        protected java.lang.String url
      • username

        protected java.lang.String username
      • password

        protected java.lang.String password
      • apiKey

        protected java.lang.String apiKey
      • secretKey

        protected java.lang.String secretKey
    • Constructor Detail

      • EspoApiClient

        public EspoApiClient()
    • Method Detail

      • requestGet

        public java.lang.String requestGet​(java.lang.String action,
                                           Params params)
                                    throws java.security.InvalidKeyException,
                                           java.io.IOException,
                                           RequestException
        Send a GET request to EspoCRM
        Parameters:
        action - The action (i.e URL path)
        params - The parameters to use
        Returns:
        Returns the JSON response
        Throws:
        java.security.InvalidKeyException - Thrown only when using HMAC authorization, if the key is invalid
        java.io.IOException
        RequestException
      • request

        public <T> java.lang.String request​(Method method,
                                            java.lang.String action,
                                            T payload)
                                     throws java.security.InvalidKeyException,
                                            java.io.IOException,
                                            RequestException
        Send a POST, PUT or DELETE request to EspoCRM
        Type Parameters:
        T - The type of payload, this will be serialized using Google's GSON
        Parameters:
        method - The request method
        action - The action (i.e URL path)
        payload - The payload to send along with the request. This will be serialized using Google's GSON
        Returns:
        Returns the JSON response
        Throws:
        java.security.InvalidKeyException - Thrown only when using HMAC authorization, if the key is invalid
        java.io.IOException
        RequestException