Interface IRestConnection

All Known Implementing Classes:
RestConnection

public interface IRestConnection
  • Field Details

  • Method Details

    • addHeader

      void addHeader​(String key, String value)
      Parameters:
      key - The HTTP header key
      value - The HTTP header value
    • get

      Response get​(Endpoint endpoint) throws SparkPostException
      Perform an HTTP GET request. This method throws an exception if the server returns anything else than a 200.
      Parameters:
      endpoint - API endpoint to send the request to.
      Returns:
      Server response to the request.
      Throws:
      SparkPostException - if something goes wrong
    • post

      Response post​(Endpoint endpoint, String json) throws SparkPostException
      Perform an HTTP POST request. This method throws an exception if the server returns anything else than a 200.
      Parameters:
      endpoint - API endpoint to send the request to.
      json - POST data block to send with the request. May be null.
      Returns:
      Server response to the request
      Throws:
      SparkPostException - if something goes wrong
    • put

      Response put​(Endpoint endpoint, String json) throws SparkPostException
      Perform an HTTP PUT request. This method throws an exception if the server returns anything else than a 200.
      Parameters:
      endpoint - API endpoint to send the request to.
      json - PUT data block to send with the request. May be null.
      Returns:
      Server response to the request.
      Throws:
      SparkPostException - if something goes wrong
    • delete

      Response delete​(Endpoint endpoint) throws SparkPostException
      Perform an HTTP DELETE request. This method throws an exception if the server returns anything else than a 200.
      Parameters:
      endpoint - API endpoint to send the request to.
      Returns:
      Server response to the request.
      Throws:
      SparkPostException - if something goes wrong