I am getting an error while creating a request in JIRA service desk as XSRF check failed.

Saif Ali June 9, 2021

I 'm trying to hit a create issue request using docs here :

Jira REST API examples (atlassian.com)

SO far I'm able to get project ID and key then issue type ID succesfully.

But as soon as I'm trying to create an issue using below JSON body

{
"fields": {
"project":
{
"id": "TER"
},
"summary": "No REST for the Wicked.",
"description": "Creating of an issue using IDs for projects and issue types using the REST API",
"issuetype": {
"id": "11112"
}
}
}

 

I'm getting a response saying "XSRF check failed"

As per the documentation available here : XSRF check failed when calling Cloud APIs | Atlassian Cloud | Atlassian Documentation

I have added the header 

X-Atlassian-Token: no-check

but the issue remained same 

URL - POST :  http://<mydomain>.atlassian.net/rest/api/2/issue/ 

Authorization is basic - Username and API key as password

Headers - Content-Type" : "application/json"

Please note : I'm using postman for the testing.

Am I missing something ? I have a site admin and project administrator permissions.

1 answer

1 accepted

0 votes
Answer accepted
Muhammad Ramzan(Atlassian Certified Master)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2021

Can you please share the Post man screen shot with request data and headers, regarding the above JSON which you shared , I found one issue there, please fix it.

If you use "Id" then provide the project id eg. 10001,1003

if you use  "Key" then you can use project key 

In above JSON you are using Id Param but the value is project key, it should be the project id.

Saif Ali June 9, 2021

Thanks @Muhammad Ramzan(Atlassian Certified Master)  for replyiing

So below is a snapshot of my postman headers :

Postman2.JPG

 

Thanks for your suggestion , I have changed the JSON as below :

 

{
"fields": {
"project":
{
"id": "14215"
},
"summary": "No REST for the Wicked.",
"description": "Creating of an issue using IDs for projects and issue types using the REST API",
"issuetype": {
"id": "11112"
}
}
}

 

But it's still same

Muhammad Ramzan(Atlassian Certified Master)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2021

Thanks for sharing the image, can you please replace http with https and then try

Saif Ali June 9, 2021

Thanks @Muhammad Ramzan(Atlassian Certified Master) , It worked successfully. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events