Class FDRestUtils
java.lang.Object
flexagon.fd.model.integration.util.FDRestUtils
Utility functions for invoking REST calls, which can be used in custom Groovy code for change
management and issue tracking system implementations
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckValidJsonResponse(FlexRESTClientResponse pClientResponse) JsonObjectgetRequest(String pHostName, String pResourcePath, String pBearerToken) Invoke GET request using bearer token to authenticateJsonObjectgetRequest(String pHostName, String pResourcePath, String pUserName, String pPassword) Invoke GET request using basic authenticationJsonObjectgetRequest(String pHostName, String pResourcePath, Map<String, Serializable> pQueryParams, String pBearerToken) Invoke GET request using bearer token to authenticateJsonObjectgetRequest(String pHostName, String pResourcePath, Map<String, Serializable> pQueryParams, String pUserName, String pPassword) Invoke GET request using basic authenticationJsonArraygetRequestArray(FlexRESTClient pClient) JsonArraygetRequestArray(String pHostName, String pResourcePath, Map<String, Object> pQueryParams, String pAccessToken) JsonArraygetRequestArray(String pHostName, String pResourcePath, Map<String, Object> pQueryParams, String pUserName, String pPassword) JsonObjectpatchRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) Invoke PATCH request using bearer token to authenticateJsonObjectpatchRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) Invoke PATCH request using basic authenticationJsonObjectpatchRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke PATCH request using basic authenticationJsonObjectpatchRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke PATCH request using bearer token to authenticateJsonObjectpostRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) Invoke POST request using bearer token to authenticateJsonObjectpostRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) Invoke POST request using basic authenticationJsonObjectpostRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke POST request using basic authenticationJsonObjectpostRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke POST request using bearer token to authenticateJsonObjectputRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) Invoke PUT request using bearer token to authenticateJsonObjectputRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) Invoke PUT request using basic authenticationJsonObjectputRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke PUT request using basic authenticationJsonObjectputRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) Invoke PUT request using bearer token to authenticatebooleantestConnection(String pHostName, String pResourcePath, String pBearerToken) Test connection to external system with get call using bearer token to authenticatebooleantestConnection(String pHostName, String pResourcePath, String pUserName, String pPassword) Test connection to external system with get call using basic authentication
-
Constructor Details
-
FDRestUtils
public FDRestUtils()
-
-
Method Details
-
testConnection
public boolean testConnection(String pHostName, String pResourcePath, String pUserName, String pPassword) throws ApiException Test connection to external system with get call using basic authentication- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpUserName- User name to connect aspPassword- Password to authenticate with- Returns:
- Result of test connection
- Throws:
ApiException- If response code is invalid
-
testConnection
public boolean testConnection(String pHostName, String pResourcePath, String pBearerToken) throws ApiException Test connection to external system with get call using bearer token to authenticate- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpBearerToken- Bearer token added to authentication header- Returns:
- Result of test connection
- Throws:
ApiException- If response code is invalid
-
getRequest
public JsonObject getRequest(String pHostName, String pResourcePath, String pUserName, String pPassword) throws ApiException Invoke GET request using basic authentication- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpUserName- User name to connect aspPassword- Password to authenticate with- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
getRequest
public JsonObject getRequest(String pHostName, String pResourcePath, Map<String, Serializable> pQueryParams, String pUserName, String pPassword) throws ApiExceptionInvoke GET request using basic authentication- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappUserName- User name to connect aspPassword- Password to authenticate with- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
getRequestArray
public JsonArray getRequestArray(String pHostName, String pResourcePath, Map<String, Object> pQueryParams, String pUserName, String pPassword) throws ApiException- Throws:
ApiException
-
getRequestArray
public JsonArray getRequestArray(String pHostName, String pResourcePath, Map<String, Object> pQueryParams, String pAccessToken) throws ApiException- Throws:
ApiException
-
getRequest
public JsonObject getRequest(String pHostName, String pResourcePath, String pBearerToken) throws ApiException Invoke GET request using bearer token to authenticate- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpBearerToken- Bearer token added to authentication header- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
getRequest
public JsonObject getRequest(String pHostName, String pResourcePath, Map<String, Serializable> pQueryParams, String pBearerToken) throws ApiExceptionInvoke GET request using bearer token to authenticate- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappBearerToken- Bearer token added to authentication header- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
getRequestArray
public JsonArray getRequestArray(FlexRESTClient pClient) throws ApiException - Throws:
ApiException
-
postRequest
public JsonObject postRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) throws ApiException Invoke POST request using basic authentication- Parameters:
pHostName- Base URLpResourcePath- Resource path to append to base URLpUserName- User name to connect aspPassword- Password to authenticate withpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
postRequest
public JsonObject postRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke POST request using basic authentication- Parameters:
pHostName- Base URLpUserName- User name to connect aspPassword- Password to authenticate withpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
postRequest
public JsonObject postRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) throws ApiException Invoke POST request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
postRequest
public JsonObject postRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke POST request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
putRequest
public JsonObject putRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) throws ApiException Invoke PUT request using basic authentication- Parameters:
pHostName- Base URLpUserName- User name to connect aspPassword- Password to authenticate withpResourcePath- Resource path to append to base URLpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
putRequest
public JsonObject putRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke PUT request using basic authentication- Parameters:
pHostName- Base URLpUserName- User name to connect aspPassword- Password to authenticate withpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
putRequest
public JsonObject putRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) throws ApiException Invoke PUT request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
putRequest
public JsonObject putRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke PUT request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
patchRequest
public JsonObject patchRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) throws ApiException Invoke PATCH request using basic authentication- Parameters:
pHostName- Base URLpUserName- User name to connect aspPassword- Password to authenticate withpResourcePath- Resource path to append to base URLpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
patchRequest
public JsonObject patchRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke PATCH request using basic authentication- Parameters:
pHostName- Base URLpUserName- User name to connect aspPassword- Password to authenticate withpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
patchRequest
public JsonObject patchRequest(String pHostName, String pBearerToken, String pResourcePath, String pPayload) throws ApiException Invoke PATCH request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
patchRequest
public JsonObject patchRequest(String pHostName, String pBearerToken, String pResourcePath, Map<String, Serializable> pQueryParams, String pPayload) throws ApiExceptionInvoke PATCH request using bearer token to authenticate- Parameters:
pHostName- Base URLpBearerToken- Bearer token added to authentication headerpResourcePath- Resource path to append to base URLpQueryParams- Query parameter mappPayload- JSON request body- Returns:
- JSON response object
- Throws:
ApiException- If response code is invalid
-
checkValidJsonResponse
public void checkValidJsonResponse(FlexRESTClientResponse pClientResponse) throws ApiException - Throws:
ApiException
-