Package com.mindsdb.client
Class RestClient
java.lang.Object
com.mindsdb.client.RestClient
Utility class for sending HTTP requests using the Unirest library.
This class provides methods to simplify making HTTP requests, including
POST, PATCH, GET, and DELETE methods. Each method allows for the inclusion of
a request body where applicable.
Note: Ensure that the Unirest library is included in your project dependencies to use this class effectively. Proper error handling should be implemented when processing the responses from the HTTP requests.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionkong.unirest.core.HttpResponse<String>
sendDeleteRequest
(String endPoint) Sends an HTTP DELETE request to the specified endpoint.kong.unirest.core.HttpResponse<String>
sendGetRequest
(String endPoint) Sends an HTTP GET request to the specified endpoint.kong.unirest.core.HttpResponse<String>
sendPatchRequest
(String endPoint, String body) Sends an HTTP PATCH request to the specified endpoint with the given request body.kong.unirest.core.HttpResponse<String>
sendPostRequest
(String endPoint, String body) Sends an HTTP POST request to the specified endpoint with the given request body.void
shutDown()
-
Constructor Details
-
RestClient
-
RestClient
-
-
Method Details
-
sendPostRequest
public kong.unirest.core.HttpResponse<String> sendPostRequest(String endPoint, String body) throws Exception Sends an HTTP POST request to the specified endpoint with the given request body.- Parameters:
endPoint
- The URL endpoint to which the request is sent.body
- The body of the POST request.- Returns:
- An HttpResponse containing the response from the server.
- Throws:
Exception
-
sendPatchRequest
public kong.unirest.core.HttpResponse<String> sendPatchRequest(String endPoint, String body) throws Exception Sends an HTTP PATCH request to the specified endpoint with the given request body.- Parameters:
endPoint
- The URL endpoint to which the request is sent.body
- The body of the PATCH request.- Returns:
- An HttpResponse containing the response from the server.
- Throws:
Exception
-
sendGetRequest
Sends an HTTP GET request to the specified endpoint.- Parameters:
endPoint
- The URL endpoint to which the request is sent.- Returns:
- An HttpResponse containing the response from the server.
- Throws:
Exception
-
sendDeleteRequest
Sends an HTTP DELETE request to the specified endpoint.- Parameters:
endPoint
- The URL endpoint to which the request is sent.- Returns:
- An HttpResponse containing the response from the server.
- Throws:
Exception
-
shutDown
public void shutDown()
-