Package core.helpers

Class RestApiHelper


  • public class RestApiHelper
    extends Object
    • Constructor Detail

      • RestApiHelper

        public RestApiHelper()
    • Method Detail

      • runApiContaining

        public static void runApiContaining​(String identifier,
                                            String prefix,
                                            String getApi,
                                            String targetApiId,
                                            String variable,
                                            String targerApi)
                                     throws org.json.JSONException
        runApiContaining("name", "zzz_","getCompanies", "id","companyId","deleteCompany") get all companies with name containing zzz_, Then gets id of these companies, stores them in companyId variable And calls deleteCompany
        Parameters:
        getApi - : api to search for identifier. eg. name containing "zzz"
        prefix - : value containing in getApi. eg. name containing "zzz"
        identifier - : api to call to get all values. eg. getCompanies
        targetApiId - : id used to call target api.eg. id for deleteCompany api
        variable - : variable the id is stored in csv keyword file. eg companyId
        targerApi - : api to call. eg. deleteCompany
        Throws:
        org.json.JSONException
      • runApiEquals

        public static void runApiEquals​(String identifier,
                                        String value,
                                        String getApi,
                                        String targetApiId,
                                        String variable,
                                        String targerApi)
                                 throws org.json.JSONException
        runApiEquals("name", "test123","getCompanies", "id","companyId","deleteCompany") get all companies with name equals test123, Then gets id of these companies And calls delete with id
        Parameters:
        getApi - : api to search for identifier. eg. name equals "test123"
        value - : value containing in getApi. eg. name equals "test123"
        identifier - : api to call to get all values. eg. getCompanies
        targetApiId - : id used to call target api.eg. id for deleteCompany api
        variable - : variable the id is stored in csv keyword file. eg companyId
        targerApi - : api to call. eg. deleteCompany
        Throws:
        org.json.JSONException