Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

XSRF check failed while creating issue with Jquery JIRA REST API

vamshi81 June 28, 2017

Hi!
I am a complete beginner to JIRA and AJAX in general. I am trying to create an issue and this is my code: 

$.ajax({
type:"POST",
url: "https://jira.company.com/rest/api/2/issue",
dataType: "json",
headers: {


'Content-Type':'application/json',
'X-Atlassian-Token':'nocheck',
},
username: "username",
password: "password",
data:{
"fields":{
"project":{
"key":"AUTO"
},
"summary": "This is a trial for JIRA integration",
"description": "JIRA integration trial",
"issuetype":{
"name":"Bug"
}
}
},
success: function(){
console.log("issue logged");
},
error: function(xhr, status, error) {
alert(xhr.getAllResponseHeaders());
}
})



The problem is, I am getting an XSRF check failed error. with the following error message in chrome:

Response for preflight has invalid HTTP status code 403.

Please help. Thanks in advance. 

1 answer

0 votes
Durgesh Gupta June 29, 2017

In your curl command: -H "X-Atlassian-Token:no-check"

It should be 'nocheck' without '-'

The following command tested working in my local instance:

curl -H "X-Atlassian-Token:nocheck" -u username:xxxx 'http://<<System IP>>/rest/api/2/issue/TP-333/attachments' -X POST -F file=@<<file path>>

vamshi81 July 10, 2017

But I did use nocheck without hyphen in my ajax query 

 

vamshi81 July 10, 2017

And I am not even using CURL . I am using JS. 

 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events