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>
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.