Automatic Creation of Defect

Dear Atlassian's,

I am working upon a project in which i have a requirement to automatically create defects using scripting.

My question is to is there any guide which could help me to achieve the task and What all attributes exposed to user(for e.g. can i post attachments, link jira defect to other existing Jira defects.)

your views on above vital to me, please do share your thoughts.

Regards, Rohit

Rohit.Singh@egonzehnder.com

+919560553033

4 answers

This widget could not be displayed.

You can call below code in you project.

Save below code in .vbs file and execute the vbs file accordinly. You need to further investigate how you can change parameters, add attachment etc.

You need to enable rest api in jira if not already.

Dim restReq, url
Set restReq = CreateObject("Microsoft.XMLHTTP")
username = "<yourusername>"
password = "yourpassword>"
url = "https://jiraurl/rest/api/2/issue?os_username=" & username & "&os_password=" & password & ""
msgbox url
restReq.open "POST", url, false
restReq.setRequestHeader "Content-Type", "application/json"
postdata = "{""fields"": { ""project"":{ ""key"": ""projectket"" },""summary"": ""Created via rest api"", ""customfield_10301"": {""name"":""it is group picker single field""} ,""priority"": {""name"":""Minor""} ,""description"": ""Created via rest api"", ""issuetype"": {""name"": ""type of issue"" }}}"
restReq.send postdata
Msgbox restReq.responseText

Hi Paresh,

The code below is not returning the desired result:

Unable to post defect

***********************************************************

Dim restReq, url

Set restReq = CreateObject("Microsoft.XMLHTTP")

username = "abc"

password = "xyz"

url = "http://10.0.51.30:8080/secure/Dashboard.jspa?os_username=" & username & "&os_password=" & password & ""

restReq.open "POST", url, False

restReq.setRequestHeader "Content-Type", "application/json"

postdata = "{""fields"": { ""project"":{ ""key"": ""Orchestra Mobile"" },""summary"": ""Test Automation"", ""issuetype"": {""name"":""Task""} }}"

restReq.send postdata

***********************************************************
restReq.responseText shows response login/dashboard page

what is the error

I have not received any error but received a responseText

as screenshot below: And No defect is reported

ResponseText is just returning the URL response, defect is not reported.

You are using wrong URL.

change it to

url = "https://10.0.51.30:8080/rest/api/2/issue?os_username=" & username & "&os_password=" & password & ""

This widget could not be displayed.

JIRA Command Line Interface (CLI) is an alternative is you want to minimize development costs.

Thanks Bob.

This give the fair idea about Methods and Parameters but still i want to know how can i find syntax for parameters. Just want to be sure before creating automatic defects as i have to work upon live environment for test.

The action and parameter reference is found here. Specific parameters will depend on what you want to do. A simple example is:

--action createIssue --project XXX --type Bug --summary "My summary"

I recommend creating a test project to play with so you can clean it up later.

I have downloaded __ cli-plugin-jira-3.9.0.obr pluggin but unable to install it.

Can you help me out.

From these discussions, you want the JIRA Command Line Interface (CLI) client available from the Marketplate Get It Now link. Follow the installation instrucutions - Installation and Use.

This widget could not be displayed.

Hi Paresh,

Thanks for your valuable information. I hope this will do.

But i have concern how can i find Syntax of the 'postdata' parameters such as priority, affected version/s etc.

This widget could not be displayed.

Hi Paresh,

The code below is not returning the desired result:

Unable to post defect

***********************************************************

Dim restReq, url

Set restReq = CreateObject("Microsoft.XMLHTTP")

username = "abc"

password = "xyz"

url = "http://10.0.51.30:8080/secure/Dashboard.jspa?os_username=" & username & "&os_password=" & password & ""

restReq.open "POST", url, False

restReq.setRequestHeader "Content-Type", "application/json"

postdata = "{""fields"": { ""project"":{ ""key"": ""Orchestra Mobile"" },""summary"": ""Test Automation"", ""issuetype"": {""name"":""Task""} }}"

restReq.send postdata

***********************************************************
restReq.responseText shows response login/dashboard page

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
Published yesterday in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

102 views 0 8
Read article

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