Package com.testmonitor.api
Class Connector
java.lang.Object
com.testmonitor.api.Connector
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbaseUrl()protected Stringorg.json.JSONObjectPerform a GET request.org.json.JSONObjectPerform a GET request with GET parameters.org.json.JSONObjectPerform a POST request.org.json.JSONObjectpostAttachment(String uri, File file) Send an attachment.org.json.JSONObjectPerform a PUT request.org.json.JSONObjectrequest(org.apache.hc.client5.http.classic.methods.HttpUriRequestBase httpUriRequestBase) Perform a request on teh TestMonitor API
-
Constructor Details
-
Connector
- Parameters:
domain- The TestMonitor domaintoken- The auth token
-
-
Method Details
-
baseUrl
- Returns:
- The TestMonitor API base url.
-
baseUrl
- Parameters:
path- The path to concatenate- Returns:
- The TestMonitor API base url.
-
get
Perform a GET request.- Parameters:
uri- A relative path- Returns:
- The HTTP response as a JSONObject.
- Throws:
IOException
-
get
public org.json.JSONObject get(String uri, List<org.apache.hc.core5.http.NameValuePair> params) throws IOException, URISyntaxException Perform a GET request with GET parameters.- Parameters:
uri- A relative pathparams- Key/Value- Returns:
- The HTTP response as a JSONObject.
- Throws:
IOExceptionURISyntaxException
-
post
public org.json.JSONObject post(String uri, List<org.apache.hc.core5.http.NameValuePair> params) throws IOException Perform a POST request.- Parameters:
uri- A relative pathparams- The arguments to post- Returns:
- The HTTP response as a JSONObject.
- Throws:
IOException
-
put
public org.json.JSONObject put(String uri, List<org.apache.hc.core5.http.NameValuePair> params) throws IOException Perform a PUT request.- Parameters:
uri- A relative pathparams- The arguments to put- Returns:
- The HTTP response as a JSONObject.
- Throws:
IOException
-
postAttachment
Send an attachment.- Parameters:
uri- A relative pathfile- The file attachment- Returns:
- The HTTP response as a JSONObject.
- Throws:
IOException
-
request
public org.json.JSONObject request(org.apache.hc.client5.http.classic.methods.HttpUriRequestBase httpUriRequestBase) throws IOException Perform a request on teh TestMonitor API- Parameters:
httpUriRequestBase- The HTTP request- Returns:
- HTTP response converted to JSON format
- Throws:
IOException
-