Package org.seed.core.api
Interface RestClient
public interface RestClient
A
RestClient
is a client for REST services.
It can be used to query data from the service or send data to the service.- Author:
- seed-master
-
Method Summary
Modifier and TypeMethodDescriptionSends a GET request for the given path and returns the response as String.<T> T
Sends a GET request for the given path with the given parameters and returns the response as an object of the given response typeSends a GET request for the given path with the given parameters and returns the response as String.<T> T
Sends an object via a POST request for the given path and returns the response as an object of the given response type<T> T
Sends an object via a POST request for the given path with the given parameters and returns the response as an object of the given response type
-
Method Details
-
get
Sends a GET request for the given path and returns the response as String.- Parameters:
path
- the request path- Returns:
- the response as String
-
get
Sends a GET request for the given path with the given parameters and returns the response as String.- Parameters:
path
- the request pathparams
- a map of named parameters- Returns:
- the response as String
-
get
Sends a GET request for the given path with the given parameters and returns the response as an object of the given response type- Type Parameters:
T
- the type of the response object- Parameters:
path
- the request pathresponseType
- the class of the responseparams
- a map of named parameters- Returns:
- the response as an object of the given response type
-
post
Sends an object via a POST request for the given path and returns the response as an object of the given response type- Type Parameters:
T
- the type of the response object- Parameters:
path
- the request pathresponseType
- the class of the responserequestObject
- the object to be POSTed (may benull
)- Returns:
- the response as an object of the given response type
-
post
<T> T post(String path, Class<T> responseType, @Nullable Object requestObject, Map<String, Object> params) Sends an object via a POST request for the given path with the given parameters and returns the response as an object of the given response type- Type Parameters:
T
- the type of the response object- Parameters:
path
- the request pathresponseType
-requestObject
- the class of the responseparams
-- Returns:
- the response as an object of the given response type
-