Can't figure out API create issue problem Edited

Hi,

 

i need to be able to create issues on multiple projects when a specific transition is done in a project (multi-tenant environment). i though i could use the REST API with a CURL-based script  to do so, but i have some issue with it.

 

- i login to REST API just fine

 curl -s -c "cookies.txt" -H "X-Atlassian-Token: no-check" -d "os_username=$USERNAME" -d "os_password=$PASSWORD" -d "os_cookie=true" $JIRA_URL/login.jsp --output login.html

- i query the createmeta method and i get a response 

curl -u $USERNAME:$PASSWORD "$JIRA_URL/rest/api/2/issue/createmeta?projectKeys=$PROJECT_KEY&expand=projects.issuetypes.fields" -H "X-Atlassian-token: no-check" --output out/$PROJECT_KEY.INC_CREATE_INFO.out --silent

- i generate the JSON representation considering the fields i can see as mandatory in the "Create Issue" screen:

{
"fields": {
"project": {
"id": "11226"
},
"issuetype": {
"id": "10306"
},
"summary": "test from api",
"description": "test from api",
"assignee": {
"name": "level1"
},
"reporter": {
"name": "level1"
},
"priority": {
"id": "10001"
},
"security": {
"id": "10101"
},
"customfield_10701": "ITSEC-9087",
"customfield_10401": { "id": "12122"},
"customfield_11801": { "id": "12359"},
"customfield_10702": { "id": "10604"},
"customfield_10302": { "id": "11200"},
"customfield_11700": { "id": "12301"},
"customfield_10602": { "id": "10500"},
"customfield_10606": { "id": "10507"},
"customfield_10603": { "id": "10505"},
"customfield_10709": 100,
"customfield_10704": 100
}
}

- when i run the JSON in the REST API Browser, it works fine:

POST https://<removed>/rest/api/2/issue (201)

date: Thu, 11 Jan 2018 15:14:09 GMT
content-encoding: gzip
x-content-type-options: nosniff, nosniff
x-arequestid: 974x42645x1
status: 201
x-asen: SEN-L8621001
strict-transport-security: max-age=31536000; includeSubDomains
x-xss-protection: 1; mode=block
server: nginx
x-frame-options: SAMEORIGIN
x-seraph-loginreason: OK
vary: User-Agent
content-type: application/json;charset=UTF-8
access-control-allow-origin: https://<removed>, *
access-control-expose-headers: Origin
cache-control: no-cache, no-store, no-transform
access-control-allow-credentials: true
content-security-policy: upgrade-insecure-requests
x-asessionid: 9k65a5
x-ausername: g.moscalu%40<removed>
{
"id": "61112",
"key": "WIREFR-3009",
"self": "https://JIRA_URL/rest/api/2/issue/61112"
}

- when i run it in the script, it's not working and i have no error

HTTP/2 415 
server: nginx
date: Thu, 11 Jan 2018 15:32:24 GMT
content-type: text/html;charset=UTF-8
content-length: 0
x-arequestid: 992x43006x1
x-asen: SEN-L8621001
set-cookie: JSESSIONID=966CC9A7790CBBB998BFFECD61DFD3A0;path=/;Secure;HttpOnly
x-seraph-loginreason: OK
set-cookie: atlassian.xsrf.token=B4LU-HOEG-GX5M-JFFI|301ea3b3ff3c7157b4ff17d30a41b40c69adbdd2|lin;path=/;Secure
x-asessionid: 1emzhmh
x-ausername: g.moscalu%40<removed>
x-content-type-options: nosniff

 

Any hints/ideas?

 

I cannot see anything in the log...

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

134 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you