Package com.moesif.api.http.client
Interface HttpClient
- All Known Implementing Classes:
UnirestClient
public interface HttpClient
-
Method Summary
Modifier and TypeMethodDescriptionCreate an HTTP DELETE request with parametersdelete(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP DELETE request with parameters and with basic authenticationCreate an HTTP DELETE request with bodydeleteBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP DELETE request with body and with basic authenticationexecuteAsBinary(HttpRequest request) Execute a given HttpRequest to get binary response backvoidexecuteAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack) Execute a given HttpRequest to get binary response backvoidexecuteAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack, boolean debug) executeAsString(HttpRequest request) Execute a given HttpRequest to get string response backvoidexecuteAsStringAsync(HttpRequest request, APICallBack<HttpResponse> callBack) Execute a given HttpRequest to get string response backCreate a simple HTTP GET requestget(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create a simple HTTP GET request with basic authenticationCreate an HTTP PATCH request with parameterspatch(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP PATCH request with parameters and with basic authenticationCreate an HTTP PATCH request with bodypatchBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP PATCH request with body and with basic authenticationCreate an HTTP POST request with parameterspost(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP POST request with parameters and with basic authenticationCreate an HTTP POST request with bodypostBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP POST request with body and with basic authenticationCreate an HTTP PUT request with parametersput(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP PUT request with parameters and with basic authenticationCreate an HTTP PUT request with bodyputBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP PUT request with body and with basic authentication
-
Method Details
-
executeAsStringAsync
Execute a given HttpRequest to get string response back- Parameters:
request- The given HttpRequest to executecallBack- Callback after execution
-
executeAsBinaryAsync
Execute a given HttpRequest to get binary response back- Parameters:
request- The given HttpRequest to executecallBack- Callback after execution
-
executeAsBinaryAsync
void executeAsBinaryAsync(HttpRequest request, APICallBack<HttpResponse> callBack, boolean debug) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
executeAsBinary
Execute a given HttpRequest to get binary response back- Parameters:
request- The given HttpRequest to execute- Returns:
- the HTTP response
- Throws:
APIException- on error executing request
-
executeAsString
Execute a given HttpRequest to get string response back- Parameters:
request- The given HttpRequest to execute- Returns:
- the HTTP response
- Throws:
APIException- on error executing request
-
get
HttpRequest get(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create a simple HTTP GET request with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
get
Create a simple HTTP GET request- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params- Returns:
- the request object
-
post
Create an HTTP POST request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params- Returns:
- the request object
-
post
HttpRequest post(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP POST request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the query params_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
postBody
Create an HTTP POST request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
postBody
HttpBodyRequest postBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP POST request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
put
Create an HTTP PUT request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
put
HttpRequest put(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP PUT request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
putBody
Create an HTTP PUT request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
putBody
HttpBodyRequest putBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP PUT request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
patch
Create an HTTP PATCH request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
patch
HttpRequest patch(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP PATCH request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
patchBody
Create an HTTP PATCH request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
patchBody
HttpBodyRequest patchBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP PATCH request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
delete
Create an HTTP DELETE request with parameters- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters- Returns:
- the request object
-
delete
HttpRequest delete(String _queryUrl, Map<String, String> _headers, Map<String, Object> _parameters, String _username, String _password) Create an HTTP DELETE request with parameters and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_parameters- the request parameters_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-
deleteBody
Create an HTTP DELETE request with body- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body- Returns:
- the request object
-
deleteBody
HttpBodyRequest deleteBody(String _queryUrl, Map<String, String> _headers, String _body, String _username, String _password) Create an HTTP DELETE request with body and with basic authentication- Parameters:
_queryUrl- the URL of the HTTP request_headers- the HTTP request headers as map_body- the request body_username- for basic auth header_password- for basic auth header- Returns:
- the request object
-