[Urgent] - Auto Creation of Bugs in JIRA

I have a requirement to create auto creation of bugs in JIRA for failed Test Cases. I have searched some code related to groovy scripts and we found using API Call I am going to create the JIRA Bugs using groovy scripts.

I have used as a keyword. But while running the Scripts, execution got completed, but I am unable to find the bugs in JIRA. Could anyone suggest what is the issue I am not getting this in JIRA

def JIRADefectCreation(String username, String password) throws MalformedURLException {
def String authorizationValue = username + “:” + password
def authString = “username:password”.getBytes().encodeBase64().toString()
//authorizationValue = "Basic " + authorizationValue.bytes.encodeBase64().toString()

	def body_req = '''{

“fields” : {
“Project” : {“Key” : “EAI”},
“issuetype” : {“name” : “Bug” },
“Summary” : “test”,
“Description” : “test”}

	def connection = new URL("https://jira.digital.aig.net/rest/api/2/issue/").openConnection() as HttpURLConnection
	connection.setRequestProperty("Authorization", "Basic ${authString}")
	connection.doOutput = true
	connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8")
	def postRC = connection.getResponseCode();
		println (connection.getInputStream().getText());