Package com.morpheusdata.core.util
Class HttpApiClient
java.lang.Object
com.morpheusdata.core.util.HttpApiClient
Utility methods for calling external APIs in a standardized way.
- Since:
- 0.8.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionSets a throttle rate (in milliseconds) between HTTP Calls. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRequiredHeader
(Map<CharSequence, CharSequence> headers, String name, String value) callApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) callApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) callJsonApi
(String url, String path) callJsonApi
(String url, String path, HttpApiClient.RequestOptions opts) callJsonApi
(String url, String path, HttpApiClient.RequestOptions opts, String method) callJsonApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) callJsonApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) callXmlApi
(String url, String path, HttpApiClient.RequestOptions opts) callXmlApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) void
-
Field Details
-
throttleRate
Sets a throttle rate (in milliseconds) between HTTP Calls. This is used to slow down queries to the remote server. -
networkProxy
-
-
Constructor Details
-
HttpApiClient
public HttpApiClient()
-
-
Method Details
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
- Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callXmlApi
public ServiceResponse callXmlApi(String url, String path, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callXmlApi
public ServiceResponse callXmlApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
addRequiredHeader
public Map<CharSequence,CharSequence> addRequiredHeader(Map<CharSequence, CharSequence> headers, String name, String value) -
shutdownClient
public void shutdownClient()
-