Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

1) GET through JIRA rest api not working. 2)Unable to create query through Jquery Ajax.

Vishal Dhawan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 5, 2018

I have 2 questions, and I amstuck on them for days.

1)

2-3 days back I was able to easily fetch(GET) issues through JIRA REST API using both POSTMAN and JS.

But recently I am unable to GET the issues. DELETE is working, even it shows error when I am fetching the wrong issue. But the page just keeps loading when fetching the correct issue.

2)

Please tell me how to create issue through JS, I have tried everything I can but can't make it to work. POSTMAN does it easily, but JS gives 'PREFLIGHT ERROR 403()'. 

 

URL, Username/Password everything is right.

<script>
$(document).ready(function(){
$("#sendButton").text("Create a new query.");


$("#sendButton").click(function(){
$.ajax({
async:true,
crossDomain: true,
crossOrigin: true,
method:"POST",
url:"http://MY_URL/rest/api/2/issue",
headers:{
"Access-Control-Allow-Origin":"*",
"Authorization":"Basic USERNAME:PASSWORD(with 64 bit encoding)",
"Content-Type":"application/json"
},
processData: false,
data: JSON.stringify({
"fields":
{
"project": {
"key": "CONV",
"name": "Conval Application"
},

"summary": "TEST11.0 (PLEASE IGNORE THIS)",

"issuetype":{
"name":"Test"
},

"priority":{
"name": "Trivial (4)"
}
}
}),
success:function(data)
{
$("#readStuff").text(data);
console.log(data);
},
error:function(data)
{
$("#readStuff").text(data.status);
console.log(data);
}
});
});

});
</script>

 

 ASK1.PNGASK2.PNGASK3.PNG

0 answers

Suggest an answer

Log in or Sign up to answer