Package io.github.the_sdet.api
Class APIUtils
java.lang.Object
io.github.the_sdet.api.APIUtils
This class handles all API related Utilities and Helper methods
- Author:
- Pabitra Swain ([email protected])
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.restassured.response.ResponsedeleteRequest(String url, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL and returns the response.static io.restassured.response.ResponsedeleteRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL with base URI and endpoint, and returns the response.static io.restassured.response.ResponsedeleteRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL with base URI, endpoint, custom headers, and content type, and returns the response.static io.restassured.response.ResponsedeleteRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL and returns the response.static io.restassured.response.ResponsegetRequest(String url, io.restassured.http.ContentType contentType) Sends a GET request to the specified URL and returns the response.static io.restassured.response.ResponsegetRequest(String url, io.restassured.http.ContentType contentType, Map<String, String> queryParams) Sends a GET request with query parameters to the specified URL and returns the response.static io.restassured.response.ResponsegetRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a GET request to the specified URL with custom headers and returns the response.static io.restassured.response.ResponsegetRequest(String url, Map<String, String> headers, Map<String, String> queryParams, io.restassured.http.ContentType contentType) Sends a GET request with query parameters to the specified URL and returns the response.static io.restassured.response.ResponseheadRequest(String url, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL and returns the response.static io.restassured.response.ResponseheadRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with base URI and endpoint and returns the response.static io.restassured.response.ResponseheadRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with base URI, endpoint, custom headers, and returns the response.static io.restassured.response.ResponseheadRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with custom headers and returns the response.static io.restassured.response.ResponseoptionsRequest(String url, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL and returns the response.static io.restassured.response.ResponseoptionsRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with base URI and endpoint and returns the response.static io.restassured.response.ResponseoptionsRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with base URI, endpoint, custom headers, and returns the response.static io.restassured.response.ResponseoptionsRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with custom headers and returns the response.static io.restassured.response.ResponsepatchRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with the given request body and returns the response.static io.restassured.response.ResponsepatchRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with base URI and endpoint, the given request body, and returns the response.static io.restassured.response.ResponsepatchRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.static io.restassured.response.ResponsepatchRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with custom headers and returns the response.static io.restassured.response.ResponsepostRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with the given request body and returns the response.static io.restassured.response.ResponsepostRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with base URI, endpoint, and the given request body, and returns the response.static io.restassured.response.ResponsepostRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.static io.restassured.response.ResponsepostRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with custom headers and returns the response.static io.restassured.response.ResponseputRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with the given request body and returns the response.static io.restassured.response.ResponseputRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with base URI, endpoint, and the given request body, and returns the response.static io.restassured.response.ResponseputRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.static io.restassured.response.ResponseputRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with custom headers and returns the response.
-
Constructor Details
-
APIUtils
public APIUtils()
-
-
Method Details
-
getRequest
public static io.restassured.response.Response getRequest(String url, io.restassured.http.ContentType contentType) Sends a GET request to the specified URL and returns the response.- Parameters:
url- The URL to send the request tocontentType- Content Type- Returns:
- The response received
-
getRequest
public static io.restassured.response.Response getRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a GET request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestcontentType- Content Type- Returns:
- The response received Pabitra Swain ([email protected])
-
getRequest
public static io.restassured.response.Response getRequest(String url, io.restassured.http.ContentType contentType, Map<String, String> queryParams) Sends a GET request with query parameters to the specified URL and returns the response.- Parameters:
url- The base URL to send the request toqueryParams- The query parameters to include in the requestcontentType- Content Type- Returns:
- The response received
-
getRequest
public static io.restassured.response.Response getRequest(String url, Map<String, String> headers, Map<String, String> queryParams, io.restassured.http.ContentType contentType) Sends a GET request with query parameters to the specified URL and returns the response.- Parameters:
url- The base URL to send the request toheaders- The headers to include in the requestqueryParams- The query parameters to include in the requestcontentType- Content Type- Returns:
- The response received
-
postRequest
public static io.restassured.response.Response postRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with the given request body and returns the response.- Parameters:
url- The URL to send the request torequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received
-
postRequest
public static io.restassured.response.Response postRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received
-
postRequest
public static io.restassured.response.Response postRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with base URI, endpoint, and the given request body, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
postRequest
public static io.restassured.response.Response postRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a POST request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
putRequest
public static io.restassured.response.Response putRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with the given request body and returns the response.- Parameters:
url- The URL to send the request torequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received
-
putRequest
public static io.restassured.response.Response putRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received
-
putRequest
public static io.restassured.response.Response putRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with base URI, endpoint, and the given request body, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
putRequest
public static io.restassured.response.Response putRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PUT request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
deleteRequest
public static io.restassured.response.Response deleteRequest(String url, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL and returns the response.- Parameters:
url- The URL to send the request tocontentType- Content Type- Returns:
- The response received
-
deleteRequest
public static io.restassured.response.Response deleteRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL and returns the response.- Parameters:
url- The URL to send the request toheaders- HeaderscontentType- Content Type- Returns:
- The response received
-
deleteRequest
public static io.restassured.response.Response deleteRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL with base URI and endpoint, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIcontentType- The content type of the request- Returns:
- The response received
-
deleteRequest
public static io.restassured.response.Response deleteRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a DELETE request to the specified URL with base URI, endpoint, custom headers, and content type, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestcontentType- The content type of the request- Returns:
- The response received
-
patchRequest
public static io.restassured.response.Response patchRequest(String url, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with the given request body and returns the response.- Parameters:
url- The URL to send the request torequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received
-
patchRequest
public static io.restassured.response.Response patchRequest(String url, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- Content Type- Returns:
- The response received Pabitra Swain ([email protected])
-
patchRequest
public static io.restassured.response.Response patchRequest(String baseURI, String endpoint, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with base URI and endpoint, the given request body, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
patchRequest
public static io.restassured.response.Response patchRequest(String baseURI, String endpoint, Map<String, String> headers, String requestBody, io.restassured.http.ContentType contentType) Sends a PATCH request to the specified URL with base URI, endpoint, custom headers, request body, and content type, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestrequestBody- The request body to sendcontentType- The content type of the request- Returns:
- The response received
-
headRequest
public static io.restassured.response.Response headRequest(String url, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL and returns the response.- Parameters:
url- The URL to send the request tocontentType- The content type of the request- Returns:
- The response received
-
headRequest
public static io.restassured.response.Response headRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestcontentType- The content type of the request- Returns:
- The response received
-
headRequest
public static io.restassured.response.Response headRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with base URI and endpoint and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIcontentType- The content type of the request\- Returns:
- The response received
-
headRequest
public static io.restassured.response.Response headRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends a HEAD request to the specified URL with base URI, endpoint, custom headers, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestcontentType- The content type of the request- Returns:
- The response received
-
optionsRequest
public static io.restassured.response.Response optionsRequest(String url, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL and returns the response.- Parameters:
url- The URL to send the request tocontentType- The content type of the request- Returns:
- The response received
-
optionsRequest
public static io.restassured.response.Response optionsRequest(String url, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with custom headers and returns the response.- Parameters:
url- The URL to send the request toheaders- The headers to include in the requestcontentType- The content type of the request- Returns:
- The response received
-
optionsRequest
public static io.restassured.response.Response optionsRequest(String baseURI, String endpoint, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with base URI and endpoint and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIcontentType- The content type of the request- Returns:
- The response received
-
optionsRequest
public static io.restassured.response.Response optionsRequest(String baseURI, String endpoint, Map<String, String> headers, io.restassured.http.ContentType contentType) Sends an OPTIONS request to the specified URL with base URI, endpoint, custom headers, and returns the response.- Parameters:
baseURI- The base URI of the APIendpoint- The endpoint of the APIheaders- The headers to include in the requestcontentType- The content type of the request- Returns:
- The response received
-