Class APIUtils


  • public class APIUtils
    extends Object
    Helper methods for use with REST APIs.
    Since:
    2.6
    Author:
    Tom Page
    • Field Detail

      • ISO_INSTANT_FORMATTER

        public static final DateTimeFormatter ISO_INSTANT_FORMATTER
        The ISO instant formatter that formats or parses an instant in UTC, such as '2011-12-03T10:15:305Z' similar with DateTimeFormatter.ISO_INSTANT, but with only 3 nanoseconds
    • Method Detail

      • convertHTTPResponseToJSON

        public static org.json.JSONObject convertHTTPResponseToJSON​(org.apache.http.HttpResponse httpResponse)
        Extract the body of a HTTP response as a JSON object.
        Parameters:
        httpResponse - The HTTP response.
        Returns:
        A JSON representation of the object.
      • extractErrorMessageFromHttpResponse

        public static String extractErrorMessageFromHttpResponse​(org.apache.http.HttpResponse httpResponse)
        Util method to extract the message string from the HTTP response
        Parameters:
        httpResponse - http response
        Returns:
        error message from the http response