Package de.dlr.proseo.basewrap.rest
Class RestOps
java.lang.Object
de.dlr.proseo.basewrap.rest.RestOps
Perform REST API calls to a provided endpoint.
- Author:
- Hubert Asamer
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponseInforestApiCall(String user, String pw, String endPoint, String endPointPath, String payLoad, Map<String, String> queryParams, RestOps.HttpMethod method) Generic REST API client (currently only supporting GET, PUT and POST)
-
Constructor Details
-
RestOps
public RestOps()
-
-
Method Details
-
restApiCall
public static HttpResponseInfo restApiCall(String user, String pw, String endPoint, String endPointPath, String payLoad, Map<String, String> queryParams, RestOps.HttpMethod method) Generic REST API client (currently only supporting GET, PUT and POST)- Parameters:
user- the user to authenticate withpw- the password to authenticate withendPoint- an URL of the REST-Endpoint (e.g. http://localhost:8080)endPointPath- subroute of REST-URL (e.g. /ingest/param/987398724)payLoad- the request payload as stringqueryParams- the http query parameter (mandatory for PUT, optional for GET)method- the HTTP method (defaults to POST)- Returns:
- response object holding HTTP return code, "Warning" header, if available, and response as String, or null, if the REST request failed with an exception
-