diff --git a/tools/api-automation/extend-config2.xml b/tools/api-automation/extend-config2.xml
new file mode 100644
index 0000000..0274d88
--- /dev/null
+++ b/tools/api-automation/extend-config2.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ standard
+
+
+ UTF-8
+
+
+ https
+
+
+ ToolsQA - Cucumber Framework
+
+
+ ToolsQA - Cucumber Report
+
+
+ yyyy-MM-dd
+
+
+ HH:mm:ss
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tools/api-automation/extent-config.xml b/tools/api-automation/extent-config.xml
new file mode 100755
index 0000000..7b46c72
--- /dev/null
+++ b/tools/api-automation/extent-config.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+ standard
+
+
+
+ UTF-8
+
+
+
+ https
+
+
+ ExtentReports 2.0
+
+
+
+
+
+ Automation Report
+
+
+
+ yyyy-MM-dd
+
+
+
+ HH:mm:ss
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tools/api-automation/files/Test_formA_2.csv b/tools/api-automation/files/Test_formA_2.csv
new file mode 100644
index 0000000..7ebe032
--- /dev/null
+++ b/tools/api-automation/files/Test_formA_2.csv
@@ -0,0 +1,19 @@
+today,start,imei,end,group_1/resp_name,group_1/resp_age,group_1/resp_sex,group_1/hhh_female,group_1/child_num,group_1/photo,group_2/food,group_2/transport,group_2/total,meta/instanceID
+2018-12-14,2018-12-14T10:35:17.502000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:35:49.154000+03:00,Druid,30,2,1,2,http://classic.ona.io/api/v1/files/10488009?filename=qastuff/attachments/368110_Test_formA/Tulips-10_35_41.jpg,4000,5000,9000,n/a
+2018-12-14,2018-12-14T10:35:49.219000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:36:13.882000+03:00,Gregory,34,1,n/a,1,http://classic.ona.io/api/v1/files/10488011?filename=qastuff/attachments/368110_Test_formA/pic2-10_36_5.jpg,5000,6000,11000,n/a
+2019-02-13,2019-02-13T15:19:00.754000+03:00,enketo.ona.io:prE2UMRUzWFqhuPt,2019-02-13T15:19:33.744000+03:00,Janice,30,2,1,25,http://classic.ona.io/api/v1/files/10925902?filename=qastuff/attachments/368110_Test_formA/Desert-15_19_24.jpg,3000,4000,7000,n/a
+2019-02-13,2019-02-13T15:19:33.774000+03:00,enketo.ona.io:prE2UMRUzWFqhuPt,2019-02-13T15:20:19.963000+03:00,Kalunde,30,2,1,4,http://classic.ona.io/api/v1/files/10925917?filename=qastuff/attachments/368110_Test_formA/Hydrangeas-15_20_11.jpg,3000,5000,8000,n/a
+2021-05-27,2021-05-27T11:26:44.098000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:27:13.505000+03:00,Hannah,28,2,1,3,http://classic.ona.io/api/v1/files/20450401?filename=qastuff/attachments/368110_Test_formA/Screenshot_2021-05-24_at_17.56.33-11_27_6.png,3000,4000,7000,n/a
+2021-05-27,2021-05-27T11:27:13.631000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:10.506000+03:00,leila,27,2,1,1,n/a,4000,3000,7000,n/a
+2021-05-27,2021-05-27T11:28:10.563000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:31.761000+03:00,Jane,29,2,1,2,n/a,5000,6000,11000,n/a
+2021-05-27,2021-05-27T11:28:31.831000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:52.185000+03:00,Jason,37,1,n/a,3,n/a,4000,1000,5000,n/a
+2018-12-14,2018-12-14T10:29:30.373000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:30:42.480000+03:00,Kayla,20,2,n/a,3,http://classic.ona.io/api/v1/files/10487989?filename=qastuff/attachments/368110_Test_formA/Koala-10_30_34.jpg,3000,2000,5000,n/a
+2018-12-14,2018-12-14T10:30:42.546000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:31:00.860000+03:00,Brian,4,1,n/a,4,http://classic.ona.io/api/v1/files/10487990?filename=qastuff/attachments/368110_Test_formA/pic3-10_30_53.JPG,5000,4000,9000,n/a
+2018-12-14,2018-12-14T10:35:17.502000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:35:49.154000+03:00,Druid,30,2,1,2,http://classic.ona.io/api/v1/files/10488009?filename=qastuff/attachments/368110_Test_formA/Tulips-10_35_41.jpg,4000,5000,9000,n/a
+2018-12-14,2018-12-14T10:35:49.219000+03:00,enketo.ona.io:0CgMXF5tuvFTfOkw,2018-12-14T10:36:13.882000+03:00,Gregory,34,1,n/a,1,http://classic.ona.io/api/v1/files/10488011?filename=qastuff/attachments/368110_Test_formA/pic2-10_36_5.jpg,5000,6000,11000,n/a
+2019-02-13,2019-02-13T15:19:00.754000+03:00,enketo.ona.io:prE2UMRUzWFqhuPt,2019-02-13T15:19:33.744000+03:00,Janice,30,2,1,25,http://classic.ona.io/api/v1/files/10925902?filename=qastuff/attachments/368110_Test_formA/Desert-15_19_24.jpg,3000,4000,7000,n/a
+2019-02-13,2019-02-13T15:19:33.774000+03:00,enketo.ona.io:prE2UMRUzWFqhuPt,2019-02-13T15:20:19.963000+03:00,Kalunde,30,2,1,4,http://classic.ona.io/api/v1/files/10925917?filename=qastuff/attachments/368110_Test_formA/Hydrangeas-15_20_11.jpg,3000,5000,8000,n/a
+2021-05-27,2021-05-27T11:26:44.098000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:27:13.505000+03:00,Hannah,28,2,1,3,http://classic.ona.io/api/v1/files/20450401?filename=qastuff/attachments/368110_Test_formA/Screenshot_2021-05-24_at_17.56.33-11_27_6.png,3000,4000,7000,n/a
+2021-05-27,2021-05-27T11:27:13.631000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:10.506000+03:00,leila,27,2,1,1,n/a,4000,3000,7000,n/a
+2021-05-27,2021-05-27T11:28:10.563000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:31.761000+03:00,Jane,29,2,1,2,n/a,5000,6000,11000,n/a
+2021-05-27,2021-05-27T11:28:31.831000+03:00,enketo.ona.io:xQ8HNoTbjmYcQhXo,2021-05-27T11:28:52.185000+03:00,Jason,37,1,n/a,3,n/a,4000,1000,5000,n/a
\ No newline at end of file
diff --git a/tools/api-automation/pom.xml b/tools/api-automation/pom.xml
new file mode 100644
index 0000000..2c331aa
--- /dev/null
+++ b/tools/api-automation/pom.xml
@@ -0,0 +1,167 @@
+
+
+
+
+ 4.0.0
+
+ RestAssuredFramework
+ RestAssuredFramework
+ 1.0-SNAPSHOT
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.14.1
+
+
+ test
+ **/RunCukesTest*.java
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+
+
+
+
+ com.relevantcodes
+ extentreports
+ 2.41.0
+
+
+ io.rest-assured
+ rest-assured
+ 3.0.0
+
+
+ ru.qatools.commons
+ properties
+ 2.0.RC6
+
+
+ mysql
+ mysql-connector-java
+ 8.0.12
+
+
+ org.json
+ json
+ 20180813
+
+
+ com.google.code.gson
+ gson
+ 2.8.0
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+
+ com.sun.mail
+ javax.mail
+ 1.6.2
+
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.13-beta1
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.30
+
+
+ org.skyscreamer
+ jsonassert
+ 1.5.0
+ test
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.8
+
+
+ com.jayway.jsonpath
+ json-path
+ 2.4.0
+
+
+
+ com.google.guava
+ guava
+ 28.2-jre
+
+
+
+ io.rest-assured
+ json-schema-validator
+ 3.3.0
+ compile
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.0
+
+
+ org.postgresql
+ postgresql
+ 42.1.1
+
+
+ io.cucumber
+ cucumber-java
+ 3.0.2
+
+
+
+ io.cucumber
+ cucumber-junit
+ 3.0.2
+
+
+ junit
+ junit
+ 4.12
+
+
+ com.aventstack
+ extentreports
+ 4.0.9
+
+
+
+
+ com.vimalselvam
+ cucumber-extentsreport
+ 3.1.1
+
+
+
+ com.aventstack
+ extentreports-cucumber4-adapter
+ 1.0.7
+
+
+
\ No newline at end of file
diff --git a/tools/api-automation/src/test/java/config/ApplicationConfigReader.java b/tools/api-automation/src/test/java/config/ApplicationConfigReader.java
new file mode 100755
index 0000000..ceb9ddf
--- /dev/null
+++ b/tools/api-automation/src/test/java/config/ApplicationConfigReader.java
@@ -0,0 +1,151 @@
+
+package config;
+
+
+import ru.qatools.properties.Property;
+import ru.qatools.properties.PropertyLoader;
+import ru.qatools.properties.Resource.Classpath;
+
+
+@Classpath({"application.properties"})
+
+public class ApplicationConfigReader {
+
+ @Property("baseUrl")
+ private String baseUrl;
+ @Property("htmlReportPath")
+ private String htmlReportPath;
+ @Property("LogTestRail")
+ private String LogTestRail;
+ @Property("TestRailurl")
+ private String TestRailurl;
+ @Property("TestRailusername")
+ private String TestRailusername;
+ @Property("TestRailpassword")
+ private String TestRailpassword;
+ @Property("TestRailprojectid")
+ private String TestRailprojectid;
+ @Property("isEnableReporting")
+ private String isEnableReporting;
+ @Property("SendEmailAfterExecution")
+ private String SendEmailAfterExecution;
+ @Property("From")
+ private String From;
+ @Property("FromPassword")
+ private String FromPassword;
+ @Property("To")
+ private String[] To;
+ @Property("ProjectDescription")
+ private String ProjectDescription;
+ @Property("filePath")
+ private String filePath;
+
+
+ @Property("Project")
+ private String Project;
+ @Property("Platform")
+ private String Platform;
+ @Property("Environment")
+ private String Environment;
+
+ @Property("UpdateCase")
+ private String UpdateCase;
+
+ @Property("username")
+ private String username;
+
+ @Property("password")
+ private String password;
+
+ @Property("privateKey")
+ private String privateKey;
+
+ public ApplicationConfigReader() {
+ PropertyLoader.newInstance().populate(this);
+ }
+
+
+ public String getBaseUrl() {
+ return this.baseUrl;
+ }
+
+ public String getHtmlReportPath() {
+ return this.htmlReportPath;
+ }
+
+ public String getLogTestRail() {
+ return this.LogTestRail;
+ }
+
+ public String getTestRailurl() {
+ return this.TestRailurl;
+ }
+
+ public String getTestRailusername() {
+ return this.TestRailusername;
+ }
+
+ public String getTestRailpassword() {
+ return this.TestRailpassword;
+ }
+
+
+ public String getIsEnableReporting() {
+ return this.isEnableReporting;
+ }
+
+
+ public String getSendEmailAfterExecution() {
+ return this.SendEmailAfterExecution;
+ }
+
+ public String getFrom() {
+ return this.From;
+ }
+
+ public String getFromPassword() {
+ return this.FromPassword;
+ }
+
+ public String[] getTo() {
+ return this.To;
+ }
+
+
+ public String getProject() {
+ return this.Project;
+ }
+
+ public String getPlatform() {
+ return this.Platform;
+ }
+
+ public String getEnviroment() {
+ return this.Environment;
+ }
+
+ public String getUpdateTestRail() {
+ return this.UpdateCase;
+ }
+
+ public String getUsername() {
+ return this.username;
+ }
+
+ public String getPassword() {
+ return this.password;
+ }
+
+ public String getTestRailprojectid() {
+ return this.TestRailprojectid;
+ }
+
+ public String getPrivateKey() {
+ return this.privateKey;
+ }
+
+ public String getfilePath() {
+ return System.getProperty("user.dir")+filePath;
+ }
+
+}
\ No newline at end of file
diff --git a/tools/api-automation/src/test/java/config/ConfigProperties.java b/tools/api-automation/src/test/java/config/ConfigProperties.java
new file mode 100755
index 0000000..ffc89da
--- /dev/null
+++ b/tools/api-automation/src/test/java/config/ConfigProperties.java
@@ -0,0 +1,36 @@
+/*
+# set & get environment/globals variables
+*/
+
+package config;
+
+
+public class ConfigProperties {
+ public static config.ApplicationConfigReader appConfig = new config.ApplicationConfigReader();
+ public static String htmlReportPath = appConfig.getHtmlReportPath();
+ public static String baseUrl = appConfig.getBaseUrl();
+ public static String logTestRail = appConfig.getLogTestRail();
+ public static String testRailUsername = appConfig.getTestRailusername();
+ public static String testRailPassword = appConfig.getTestRailpassword();
+ public static String testRailUrl = appConfig.getTestRailurl();
+ public static String isReportingEnable = appConfig.getIsEnableReporting();
+
+ public static String sendEmail = appConfig.getSendEmailAfterExecution();
+ public static String from = appConfig.getFrom();
+ public static String[] To = appConfig.getTo();
+ public static String fromPassword = appConfig.getFromPassword();
+
+ public static String Project = appConfig.getProject();
+ public static String Platform = appConfig.getPlatform();
+ public static String Environment = appConfig.getEnviroment();
+ public static String username = appConfig.getUsername();
+ public static String password = appConfig.getPassword();
+ public static String testTrailProjectId = appConfig.getTestRailprojectid();
+ public static String filePath = appConfig.getfilePath();
+ public static String privateKey = appConfig.getPrivateKey();
+
+
+
+
+
+}
diff --git a/tools/api-automation/src/test/java/config/EndpointURLs.java b/tools/api-automation/src/test/java/config/EndpointURLs.java
new file mode 100755
index 0000000..141f732
--- /dev/null
+++ b/tools/api-automation/src/test/java/config/EndpointURLs.java
@@ -0,0 +1,34 @@
+
+package config;
+
+
+public class EndpointURLs {
+
+public static String GET_AUTHNETICATION = "/security/authenticate";
+public static String SYNC_BY_LOCATION= "/rest/event/sync?locationId=%s&serverVersion=0&limit=250";
+public static String SYNC_BY_PROVIDER= "/rest/event/sync?providerId=%s&serverVersion=0&limit=250";
+public static String SYNC_BY_TEAM ="/rest/event/sync?team=%s&serverVersion=0&limit=250";
+public static String GET_UNIQUE_ID_REQ ="/uniqueids/get?source=1&numberToGenerate=5";
+public static String SEARCH_CLIENT_BY_PATH="/rest/search/path?first_name=a&last_name=am";
+public static String SEARCH_CLIENT_II ="/rest/search/search?lastName=admin";
+public static String FETCH_CLIENT_BY_ID = "/rest/client/1000001V";
+public static String SEARCH_CLIENT_BY_GENDER = "/rest/client/search?gender=female";
+public static String SYNC_VIEW_CONFIGURATION = "/rest/viewconfiguration/sync?serverVersion=0";
+public static String SEARCH_CLIENT_BY_BIRTHDAY ="/rest/client/search?birthdate=2017-12-16:2019-12-19";
+public static String GET_ALL_USERS= "/rest/user?page_size=10&start_index=0&source=Keycloak";
+public static String SEARCH_CLIENT_BY_NAME = "/rest/client/search?name=web";
+public static String SYNC_SERVERSIDE_SETTING = "/rest/settings/sync?serverVersion=0";
+public static String GET_ALL_EVENTS= "/rest/event/getAll?serverVersion=0&limit=10";
+public static String GET_ALL_STOCK= "/rest/stockresource/getall?serverVersion=0&limit=10";
+public static String GET_ALL_STOCK_BY_ID= "/rest/stockresource/xxxx";
+public static String SEARCH_EVENT_BY_TEAM= "/rest/event/search?team=%s";
+public static String SEARCH_EVENT_BY_TEAM_ID= "/rest/event/search?teamId=%s";
+public static String SEARCH_EVENT_BY_LOCATION_ID ="/rest/event/search?locationId=%s";
+public static String SEARCH_EVENT_BY_PROVIDER_ID ="/rest/event/search?providerId=%s";
+public static String SEARCH_EVENT_BY_ENTITY_TYPE ="/rest/event/search?entityType=child";
+public static String SEARCH_EVENT_ID_BY_EVENT_TYPE ="/rest/event/findIdsByEventType?eventType=Birth Registration&serverVersion=0";
+public static String SEARCH_EVENT_BY_ID ="/rest/event/%s";
+public static String GET_PROVIDER_ACTION ="/actions?anmIdentifier=%s&timeStamp=1553817603433";
+public static String POST_EVENT ="/rest/event/add/";
+public static String POST_CLIENT ="/rest/client/add/";
+}
diff --git a/tools/api-automation/src/test/java/config/EnvGlobals.java b/tools/api-automation/src/test/java/config/EnvGlobals.java
new file mode 100755
index 0000000..dec8277
--- /dev/null
+++ b/tools/api-automation/src/test/java/config/EnvGlobals.java
@@ -0,0 +1,24 @@
+/*
+Define global variables to use re-use them
+ */
+
+package config;
+
+import io.restassured.specification.RequestSpecification;
+
+public class EnvGlobals {
+
+ public static String accessToken;
+ public static RequestSpecification requestSpecification;
+ public static String clientBasicEntityID_uuid;
+ public static String clientId_uuid;
+ public static String clientAddress_uuid;
+ public static String teamName;
+ public static String teamUuid;
+ public static String eventBasicEntityID_uuid;
+ public static String eventLocation_uuid;
+ public static String formSubmissionId_uuid;
+ public static String eventId_uuid;
+
+
+ }
diff --git a/tools/api-automation/src/test/java/general/APIClient.java b/tools/api-automation/src/test/java/general/APIClient.java
new file mode 100644
index 0000000..bcc02cb
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/APIClient.java
@@ -0,0 +1,159 @@
+package general;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Base64;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+
+public class APIClient {
+ private String m_user;
+ private String m_password;
+ private String m_url;
+
+ public APIClient(String base_url) {
+ if (!base_url.endsWith("/")) {
+ base_url = base_url + "/";
+ }
+
+ this.m_url = base_url + "index.php?/api/v2/";
+ }
+
+
+ public void setUser(String user) {
+ this.m_user = user;
+ }
+
+ public void setPassword(String password) {
+ this.m_password = password;
+ }
+
+
+ public Object sendPost(String uri, Object data) throws MalformedURLException, IOException, APIException {
+ return this.sendRequest("POST", uri, data);
+ }
+
+ private Object sendRequest(String method, String uri, Object data) throws MalformedURLException, IOException, APIException {
+ URL url = new URL(this.m_url + uri);
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+ String auth = getAuthorization(this.m_user, this.m_password);
+ conn.addRequestProperty("Authorization", "Basic " + auth);
+ if (method.equals("POST")) {
+ conn.setRequestMethod("POST");
+ if (data != null) {
+ if (uri.startsWith("add_attachment")) {
+ String boundary = "TestRailAPIAttachmentBoundary";
+ File uploadFile = new File((String)data);
+ conn.setDoOutput(true);
+ conn.addRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
+ OutputStream ostreamBody = conn.getOutputStream();
+ BufferedWriter bodyWriter = new BufferedWriter(new OutputStreamWriter(ostreamBody));
+ bodyWriter.write("\n\n--" + boundary + "\r\n");
+ bodyWriter.write("Content-Disposition: form-data; name=\"attachment\"; filename=\"" + uploadFile.getName() + "\"");
+ bodyWriter.write("\r\n\r\n");
+ bodyWriter.flush();
+ InputStream istreamFile = new FileInputStream(uploadFile);
+ byte[] dataBuffer = new byte[1024];
+
+ int bytesRead;
+ while((bytesRead = istreamFile.read(dataBuffer)) != -1) {
+ ostreamBody.write(dataBuffer, 0, bytesRead);
+ }
+
+ ostreamBody.flush();
+ bodyWriter.write("\r\n--" + boundary + "--\r\n");
+ bodyWriter.flush();
+ istreamFile.close();
+ ostreamBody.close();
+ bodyWriter.close();
+ } else {
+ conn.addRequestProperty("Content-Type", "application/json");
+ byte[] block = JSONValue.toJSONString(data).getBytes("UTF-8");
+ conn.setDoOutput(true);
+ OutputStream ostream = conn.getOutputStream();
+ ostream.write(block);
+ ostream.close();
+ }
+ }
+ } else {
+ conn.addRequestProperty("Content-Type", "application/json");
+ }
+
+ int status = conn.getResponseCode();
+ InputStream istream;
+ if (status != 200) {
+ istream = conn.getErrorStream();
+ if (istream == null) {
+ throw new APIException("testrail API return HTTP " + status + " (No additional error message received)");
+ }
+ } else {
+ istream = conn.getInputStream();
+ }
+
+ if (istream != null && uri.startsWith("get_attachment/")) {
+// FileOutputStream outputStream = new FileOutputStream((String)data);
+// boolean bytesRead = false;
+// byte[] buffer = new byte[1024];
+//
+// int bytesRead;
+// while((bytesRead = istream.read(buffer)) > 0) {
+// outputStream.write(buffer, 0, bytesRead);
+// }
+//
+// outputStream.close();
+// istream.close();
+ return (String)data;
+ } else {
+ String text = "";
+ String error;
+ if (istream != null) {
+ BufferedReader reader;
+ for(reader = new BufferedReader(new InputStreamReader(istream, "UTF-8")); (error = reader.readLine()) != null; text = text + System.getProperty("line.separator")) {
+ text = text + error;
+ }
+
+ reader.close();
+ }
+
+ Object result;
+ if (!text.equals("")) {
+ result = JSONValue.parse(text);
+ } else {
+ result = new JSONObject();
+ }
+
+ if (status != 200) {
+ error = "No additional error message received";
+ if (result != null && result instanceof JSONObject) {
+ JSONObject obj = (JSONObject)result;
+ if (obj.containsKey("error")) {
+ error = '"' + (String)obj.get("error") + '"';
+ }
+ }
+
+ throw new APIException("testrail API returned HTTP " + status + "(" + error + ")");
+ } else {
+ return result;
+ }
+ }
+ }
+
+ private static String getAuthorization(String user, String password) {
+ try {
+ return new String(Base64.getEncoder().encode((user + ":" + password).getBytes()));
+ } catch (IllegalArgumentException var3) {
+ return "";
+ }
+ }
+}
diff --git a/tools/api-automation/src/test/java/general/APIException.java b/tools/api-automation/src/test/java/general/APIException.java
new file mode 100644
index 0000000..4e5bf53
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/APIException.java
@@ -0,0 +1,8 @@
+package general;
+
+
+public class APIException extends Exception {
+ public APIException(String message) {
+ super(message);
+ }
+}
diff --git a/tools/api-automation/src/test/java/general/DataClass.java b/tools/api-automation/src/test/java/general/DataClass.java
new file mode 100644
index 0000000..f97769b
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/DataClass.java
@@ -0,0 +1,19 @@
+package general;
+
+import java.io.File;
+import java.util.ArrayList;
+
+public class DataClass {
+ public String summary;
+ public String Description;
+ String Method;
+ String methodName;
+ String csvRow;
+ File imageFile;
+ ArrayList automationSteps;
+ Integer lengthBeforeTestCase;
+ Integer lengthAfterTestCase;
+
+ public DataClass() {
+ }
+}
\ No newline at end of file
diff --git a/tools/api-automation/src/test/java/general/DataList.java b/tools/api-automation/src/test/java/general/DataList.java
new file mode 100644
index 0000000..82cadd7
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/DataList.java
@@ -0,0 +1,11 @@
+package general;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public interface DataList {
+ List caseid = new ArrayList();
+ List result = new ArrayList();
+ List updateData = new ArrayList();
+ List JIRA = new ArrayList();
+}
diff --git a/tools/api-automation/src/test/java/general/EnvGlobals.java b/tools/api-automation/src/test/java/general/EnvGlobals.java
new file mode 100644
index 0000000..95c0512
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/EnvGlobals.java
@@ -0,0 +1,14 @@
+package general;
+
+
+import io.restassured.response.Response;
+import io.restassured.specification.RequestSpecification;
+
+public class EnvGlobals {
+ public static StringBuilder difference = new StringBuilder();
+ public static RequestSpecification requestSpecification;
+ public static Response response;
+
+ public EnvGlobals() {
+ }
+}
\ No newline at end of file
diff --git a/tools/api-automation/src/test/java/general/GeneralFunctions.java b/tools/api-automation/src/test/java/general/GeneralFunctions.java
new file mode 100644
index 0000000..d4b1301
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/GeneralFunctions.java
@@ -0,0 +1,14 @@
+package general;
+
+
+import java.util.*;
+
+public class GeneralFunctions
+{
+
+ public static Date getTime() {
+ Calendar calendar = Calendar.getInstance();
+ return calendar.getTime();
+ }
+
+}
\ No newline at end of file
diff --git a/tools/api-automation/src/test/java/general/ReusableFunctions.java b/tools/api-automation/src/test/java/general/ReusableFunctions.java
new file mode 100644
index 0000000..b521337
--- /dev/null
+++ b/tools/api-automation/src/test/java/general/ReusableFunctions.java
@@ -0,0 +1,287 @@
+package general;
+
+import config.ConfigProperties;
+import io.restassured.RestAssured;
+import io.restassured.path.json.JsonPath;
+import io.restassured.response.Response;
+import io.restassured.response.ValidatableResponse;
+import io.restassured.specification.RequestSpecification;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+import java.io.File;
+import java.util.*;
+
+public class ReusableFunctions {
+ public static RequestSpecification REQUEST;
+
+ public ReusableFunctions() {
+ }
+
+ public static ArrayList responseList(String key) {
+ return (ArrayList)((ValidatableResponse) general.EnvGlobals.response.then()).extract().path(key, new String[0]);
+ }
+
+ public static int getResponseLength() {
+ return (Integer) general.EnvGlobals.response.body().path("list.size()", new String[0]);
+ }
+
+ public static void printResponse() {
+ if (general.EnvGlobals.response != null) {
+ System.out.println(general.EnvGlobals.response.getBody().asString());
+ }
+
+ }
+
+ public static void givenHeaderFormData(Map headers, Map formData) {
+ contentType("multipart/form-data");
+ Iterator> it = formData.entrySet().iterator();
+ Map.Entry pair;
+ if (headers == null) {
+ EnvGlobals.requestSpecification = REQUEST.given();
+
+ while(it.hasNext()) {
+ pair = (Map.Entry)it.next();
+ EnvGlobals.requestSpecification = REQUEST.given().multiPart((String)pair.getKey(), (String)pair.getValue());
+ it.remove();
+ }
+ } else {
+ EnvGlobals.requestSpecification = REQUEST.given().headers(headers);
+
+ while(it.hasNext()) {
+ pair = (Map.Entry)it.next();
+ EnvGlobals.requestSpecification = REQUEST.given().multiPart((String)pair.getKey(), pair.getValue());
+ it.remove();
+ }
+ }
+
+
+ }
+
+ public static void givenHeaderFormData(Map headers) {
+ System.out.println(headers);
+ contentType("multipart/form-data");
+ EnvGlobals.requestSpecification = REQUEST.given().headers(headers);
+ }
+
+
+ public static void addFileInHeader(String filename,String fileKey,String fileType) {
+ config.EnvGlobals.requestSpecification = ReusableFunctions.REQUEST.given().multiPart(fileKey,(new File(ConfigProperties.filePath+filename)),fileType);
+ }
+
+ public static String getResponse() {
+ return general.EnvGlobals.response != null ? general.EnvGlobals.response.getBody().asString() : null;
+ }
+
+
+ private static JSONArray sortApiResponse(JSONArray jsonArr, final String sortBy, boolean sortOrder) {
+ JSONArray sortedJsonArray = new JSONArray();
+ List jsonValues = new ArrayList();
+
+ for(int i = 0; i < jsonArr.length(); ++i) {
+ jsonValues.add(jsonArr.getJSONObject(i));
+ }
+
+ final Boolean SORT_ORDER = sortOrder;
+ Collections.sort(jsonValues, new Comparator() {
+ public int compare(JSONObject a, JSONObject b) {
+ Integer valA = new Integer(0);
+ Integer valB = new Integer(0);
+
+ try {
+ valA = (Integer)a.get(sortBy);
+ valB = (Integer)b.get(sortBy);
+ } catch (JSONException var6) {
+ }
+
+ return SORT_ORDER ? valA.compareTo(valB) : -valA.compareTo(valB);
+ }
+ });
+
+ for(int i = 0; i < jsonArr.length(); ++i) {
+ sortedJsonArray.put(jsonValues.get(i));
+ }
+
+ return sortedJsonArray;
+ }
+
+
+ public static String getResponsePath(String key) {
+ return general.EnvGlobals.response.getBody().path(key, new String[0]).toString();
+ }
+
+
+
+ public static JSONArray getResponseJson(String... params) {
+ JsonPath jsonPathEvaluator = general.EnvGlobals.response.jsonPath();
+ JSONArray jArray = new JSONArray();
+ ArrayList