call api with given parameters and returns its result
        :param url: end point
        :param data: post data
        :param files: files if needed
        :param print_response: print log if required
        :return: status code, response

def call_api(self, url, data, files={}, print_response=True):
        """
        call api with given parameters and returns its result
        :param url: end point
        :param data: post data
        :param files: files if needed
        :param print_response: print log if required
        :return: status code, response
        """
        if type(url) != str:
            return False, "Url must be string"

        if type(data) != dict:
            return False, "Data must be a dict"

        if type(files) != dict:
            return False, "Files must be a dict"

        if type(print_response) != bool:
            return False, "Print_response must be boolean"

        url = self.HOST + url
        data["format"] = "json"
        cookies = {"JSESSIONID": self.JSESSIONID}

        # Add rinputs to post data
        if self.r_inputs:
            data["inputs"] = json.dumps(self.r_inputs)

        # Add routputs to post data
        if self.r_outputs:
            data["robjects"] = ",".join(self.r_outputs)

        try:
            response = requests.post(url, data=data, files=files, cookies=cookies)
        except requests.exceptions.RequestException as exception:
            self.clear_rdata()
            return 500, {"error": str(exception)}

        status_code = response.status_code

        # Print log only if required
        if print_response:
            print status_code
            print DeployRConnection.pretty_json(response.json())

        # remove rinputs and routputs
        self.clear_rdata()

        return status_code, response.json()