Class Requester

java.lang.Object
de.justofplay.xled.utils.Requester

public class Requester extends Object
Utility class for sending HTTP requests to Twinkly devices.
  • Constructor Details

    • Requester

      public Requester()
  • Method Details

    • sendJsonPost

      public static String sendJsonPost(String url, String jsonContent, Map<String,String> headers)
      Sends a POST request with a JSON body and custom headers. Returns the full HTTP response as a string (status, headers, body).
      Parameters:
      url - The full URL to send the request to.
      jsonContent - The JSON body to send.
      headers - The headers to include in the request.
      Returns:
      The full HTTP response as a string.
    • postWithAuth

      public static String postWithAuth(String path, String jsonContent, Login _login, String _ip)
      Sends a POST request with JSON body and authentication token (if available).
      Parameters:
      path - The API path (e.g. "/xled/v1/login").
      jsonContent - The JSON body to send.
      _login - The Login object containing the authentication token.
      _ip - The device IP address.
      Returns:
      The full HTTP response as a string.
    • sendGetWithToken

      public static String sendGetWithToken(String url, String token)
      Sends a GET request with an authentication token.
      Parameters:
      url - The full URL to send the request to.
      token - The authentication token to include in the "X-Auth-Token" header.
      Returns:
      The full HTTP response as a string.