Hello, i'm new to Jira.
Is it possible to create following scenario:
For JIRA ticket created with subject:Check o365 license
- description: No spare licenses unused.
- create sub tasks for the parent ticket using REST API,
I managed to find a code for adding a comment to ticket by TICKET ID, is it possible to search by subject or description
curl -D- -dvucanovic:pass -H "Content-Type: application/json" -X POST -d '{ "body": "Test comment" }' https://jira.corp.hentsu.com/rest/api/2/issue/TECH-513/comment
Uh !, you were right Laurens, i wasted whole day on this, Atlassian documentation needs serious update for JIRA Service Desk 3.4.had to add customfield_10107,what's that ??
Is this new feature ?
anyway, i just created post if anyone needs this:
https://geekdudes.wordpress.com/2018/02/23/create-jira-subtask-using-rest-api/
Glad i could help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would advise to use the automation plugin to do this, instead of rest api.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dragan,
Then i think this is what you need: https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-Create-Subtask-using-Rest-API/qaq-p/508166
The code to create a subtask.
But you will need to find a way to call the script to create the subtask based on the subject.
Thats why i think automation is better, you can just add an event "issue created" where subject contains "Check license" then create sub task.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot Laurens !, can you point me to links or examples for automation plugins, i'm totally noob for this :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dragan,
This is the one you need: https://marketplace.atlassian.com/plugins/com.codebarrel.addons.automation/cloud/overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see it's chargable, now i know why i'm asked to find free solution :)
I'm still searching for REST API option.
Thanks !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dragan,
Scripting (hour cost) is also quite expensive :-)
So unless you got a high user count, i think it will still be the cheapest option.
But in case you still want rest api is suggest you to check out the first link.
Content: { "fields": { "project": { "key": "TEST" }, "parent": { "key": "TEST-1" }, "summary": "Sub-task of TEST-1", "description": "Don't forget to do this too.", "issuetype": { "id": "5" } } }
And then you just need to find the parent key based on a search for description and put in in the rest api call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you use cloud and <300 rule executions you can use the free version of automation: https://marketplace.atlassian.com/plugins/com.codebarrel.addons.automation.lite/cloud/overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again, meanwhile i found values for Issue subject and comment:
description and summary, but when composing a query for Technology and summary, for examples i got error and results for all tickets within project
curl -D- -u user:password -X GET -H "Content-Type: application/json" https://jira.corp.company.com/rest/api/2/search?jql=project="Technology" and summary="Check o365 license"
i got error
curl: (6) Could not resolve host: summary=Check o365 license Unknown error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
not sure but I think you need to escape the quotes for project and summary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
wow, you were right Laurens:
curl -D- -u user:password -X GET -H "Content-Type: application/json" https://jira.corp.comapny.com/rest/api/2/search?jql=project='"Technology"+AND+summary~"Check%20the%20o365%20License"'
now, how to extract key and pass it to code in firs link ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i think you will need to write a powershell/bash/perl/... script to process the requests.
Thats why i believe automation is the way to go.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
okay, i use this bash to create subtask:
curl -D- -u user:pass -X POST --data {"fields":{"project":{"key":"TECH"},"parent":{"key":"TECH-456"},"summary":"Sub-task of TECH-456","description": "Don't forget to do this too.","issuetype":{"id":"10001"}}} -H "Content-Type:application/json" https://jira.company.com/rest/api/2/issue
JSON file is in attachment
curl: (3) [globbing] unmatched close brace/bracket at pos 50
HTTP/1.1 400
Date: Thu, 22 Feb 2018 19:01:53 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: nginx/1.10.2
X-AREQUESTID: 1141x104118x1
X-ASEN: SEN-6467483
Set-Cookie: JSESSIONID=26812A29DDF33852DBF21FFCED126F82;path=/;Secure;HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=B8QW-16KW-V2F7-JHDF|a6862b0311b0f2eab0ff6151de67eeb64283de9f|lin;path=/;Secure
X-ASESSIONID: j1ez3l
Cache-Control: no-cache, no-store, no-transform
X-Content-Type-Options: nosniff {"errorMessages":["Unexpected character ('f' (code 102)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@260ee49e; line: 1, column: 3]"]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
curl -D- -u user:pass -X POST --data {"fields":{"project":{"key":"TECH"},"parent":{"key":"TECH-456"},"summary":"Sub-task of TECH-456","description": "Don't forget to do this too.","issuetype":{"id":"10001"}}} -H "Content-Type:application/json" https://jira.company.com/rest/api/2/issue
{"errorMessages":["Unexpected character ('f' (code 102)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4e5fc6ec; line: 1, column: 3]"]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.