Skip to end of metadata
Go to start of metadata

 

Related Plugins

CLI Plugin for JIRA

  • Bringing ACLI capabilities to JIRA workflow

CLI Plugin for Confluence

  • Bringing ACLI capabilities to Confluence pages

CLI Plugin for Bamboo

  • Bringing ACLI capabilities to Bamboo builds

CLI Plugin for Stash

  • Bringing ACLI capabilities to Stash commits

 

 

Description

This is a command line interface (CLI) for remotely accessing JIRA. This provides a convenient way to automate JIRA administration and include JIRA content as part of other automation. Examples are build and test automation or other business processes. This is a working command line client that can be used directly with your installation. This CLI uses JIRA's SOAP and REST remote APIs.

Features

  1. Enables automation of JIRA
  2. Enabler for migrating content to JIRA
  3. Standard interfaces across product specific CLIs
  4. Consistent error handling
  5. Value added capabilities over and above product provided remote APIs
  6. List actions support CSV output
  7. Minimize script writing using a variety of run actions, such as runrunFromSqlrunFromCsv,runFromList, and product specific runFrom

Requirements

A commercial license is required for version 3.0 or higher. See Atlassian CLI license for more information.

  • No labels

235 Comments

  1. Does not seem that the interface allows me to "release" a version of a project from the command line. But I thought I would ask to make sure.
    Thanks

    1. No, please create an issue.

  2. Bob, jiraGetIssue is not working for me.  I used getProjectList so I know my connection credentials are good.

    We changed the Jira name "Issue" to "ID" on our system.  Do you suppose this is causing the problem?  This is what I get when looking for JRA-104, which I know exists:

    C:\Apps\jira-cli-1.5.0>jira --action getIssue "JRA-104"
    Error: Unexpected argument: JRA-104

    Thanks.

    Raye

    1. Look more carefully at the help text and examples so you know how to specify parameters. Try:

      jira --action getIssue --issue JRA-104
      
  3. I was wondering if the action setFieldValue can be used to set the value of a custom field of type cascade select? I have been attempting to get this to work and so far can get the setField Value action to set the parent value of the cascade select field but not the child value.

    Thanks

    Dale

    1. No, only the more simple field value types are supported currently. I won't have a list until more test are developed, so you pretty much have to try the ones you are interested in and report ones that don't work. Please write up an issue to support a specific field types. I will look into the most common or popular requests.

  4. Is there a way to not use the "pretty print" in getIssue?

    1. Create an issue if you would like to see a different output format. I have a few other cases recently that required different output options. You need to be explicit on what you have in mind.

  5. Using the linkIssue command, I get back text indicating that the issue was linked, and the errorlevel reported is also 0, so it appears to succeed.

    However, viewing the issues in a web browser, neither of them have links to the other.  I tried the example's [-link "relates to"]; then I tried again, with [-link "contains"], with the same result.

    We use JIRA 3.13.3 here.

    I also want to manipulate Watchers (read them from one ticket, and add them to a different ticket), which I don't see here, or in the SOAP API.

    1. Is JCLI-55 your problem? If not, follow the advice in that item and if you still have a problem, create a new issue with details. Thanks.

      Regarding watchers, nothing available in SOAP. Some work (non SOAP) was started on that for Confluence. Write up an improvement request if its not already there.

      1. Thanks for the response, Bob.  I've created a ticket (JSP-54616).  Following JCLI-55   , I've been able to make it work from a command line, with this template:

        jira.bat --user user --password pass --action linkIssue --server http://fpjira001.na.atxglobal.com:8080/ --issue "TST-2555   " --toIssue "TST-2575   " --link "is contained by" -v

        I see that this generates the following GET request:

        http://fpjira001.na.atxglobal.com:8080//secure/LinkExistingIssue.jspa?os_username=user&os_password=pass&id=31030&linkKey=TST-2575&linkDesc=is+contained+by

        Where does it get the "31030" from?  I believe this "id" identifies the other ticket, TST-2555   .  If I was able to somehow ask JIRA for the id of a ticket, then I could form my own GET request, and wouldn't have to invoke the command-line client.

        It would be fine to invoke it, except that it's hanging during testing.  I'm using Komodo, the ActiveState IDE for Perl (and other languages; I'm using Perl).  In my Perl script, I do a "system( $cmd );", where $cmd is the above (second paragraph).  It invokes that, and gives the following output:

        Entering createJiraBuildTicket()
        Files [myapp.sql, myapp.db] attached successfully.
        About to invoke [jira.bat --user user --password pass --action linkIssue --server http://fpjira001.na.atxglobal.com:8080/ --issue "TST-2555   " --toIssue "TST-2575   " --link "is contained by" -v]
        Server address: http://fpjira001.na.atxglobal.com:8080//rpc/soap/jirasoapservice-v2
        Successful login to: http://fpjira001.na.atxglobal.com:8080//rpc/soap/jirasoapservice-v2 by user: build
        Server address: http://fpjira001.na.atxglobal.com:8080/
        URL requested: http://fpjira001.na.atxglobal.com:8080//secure/LinkExistingIssue.jspa?os_username=user&os_password=pass&id=31030&linkKey=TST-2575&linkDesc=is+contained+by
        Request type: GET

        But then it just sits there.  In Process Monitor I can see that perl.exe invoked cmd.exe which invoked java.exe, but I don't see what's taking it so long.  When I ran it from the command line, I got similar output to the above, and an additional two lines of output:

        Issue TST-2555    is contained by TST-2568   
        nIo7w505b7 logged out.

        (Note that I was linking to a different ticket.)

        Now, all that said (and, it's still hung as I'm typing this, so it's been 10 minutes or so), it did link the tickets together!  And, it just finished (~15 minutes, perhaps there's a timeout somewhere with that value -- saying this in case it helps debugging), giving the following output (after the "Request type: GET" line):

        org.swift.common.cli.CliClient$ClientException: Error - invalid request: java.net.ConnectException: Connection refused: connect
            at org.swift.common.cli.AbstractRestClient.restRequestWithUrl(AbstractRestClient.java:307)
            at org.swift.common.cli.AbstractRestClient.restRequest(AbstractRestClient.java:218)
            at org.swift.common.cli.AbstractRestClient.restRequest(AbstractRestClient.java:198)
            at org.swift.common.cli.AbstractRestClient.restRequest(AbstractRestClient.java:189)
            at org.swift.jira.cli.JiraClient.linkIssue(JiraClient.java:1214)
            at org.swift.jira.cli.JiraClient.handleRequest(JiraClient.java:314)
            at org.swift.common.cli.AbstractRemoteClient.process(AbstractRemoteClient.java:90)
            at org.swift.common.cli.CliClient.doWork(CliClient.java:160)
            at org.swift.jira.cli.JiraClient.main(JiraClient.java:110)

        Also, note that the errorlevel it returned was 0!  It should really return something other than 0, on error.

        So, if I can get the "id" I think I can make it work without depending on the command-line client.  And, looking at the return from the "create_issue" call (from CPAN's JIRA::Client Perl module), it does have an "id" field, with a value very much like the above id, so I will try this and see if it works.  So, even though I think I may have found the right answer, I'm going to leave the above in -- both for feedback, and also in case it helps others trying to achieve this.

        .

        And, regarding the Watcher read/write functionality: the solution doesn't necessarily have to be SOAP; if I can do it with a GET request (like above), that would be fine also.

        I am very new to JIRA, so any additional info you can provide would be helpful.  I saw in passing a reference to "Jelly" scripting language, which might be useful in this regard?  It's not currently turned on, on our server, but if this will give us the functionality we desire then I'm sure we can do so; let me know.  Thanks again!

  6. Hi,

    how can I create an issue with a multiline description, i.e. enter carriage return/line feeds to the description? Something like --description "1. Row\n2.Row" does not work.

    I am also having trouble with the character set. The german "ä, ü, ö" are not working when used in summary or description.

    Cheers

    Thomas

      1. Use --description "1. Row \n 2.Row" - I believe that was added in 1.5.0. Also --file always respects line ends.
      2. Encoding - there is better file encoding support in the next release coming soon. However, I was able to get your example using without that on my system. Please create an issue with details on client and server systems as I expect one or both are windows (smile) with non UTF-8 encodings.
      1. The first solution worked, thanks.

        I created JCLI-64 concerning the character encoding issue.

        1. Here's the solution (for everyone out there who wanta to use german characters ä, ü, ö in shell scripts):

          1. Change the font in the CMD Box to "Lucida Console"
          2. The first command in the script should be "chcp 1252", thus setting codepage 1252

          Cheers

          Thomas

          1. Thanks for sharing (smile). Here is a reference: http://www.computerhope.com/chcphlp.htm

  7. Hi,

    I am trying to use this to create issues.  Can someone tell me how to create an issue and add info for multiple custom fields?  it will not let me execute the --custom function more than once and I cannot find the syntax to update multiple fields.

    Thanks

    Brian

    1. It is described on this page - scan for --custom. Basically it is a comma separated list. I will add a more complex example next time as well - for instance --custom "custom1:xxxx, 'custom2:yyyy,zzzz' ".

      1. Thanks for the info Bob.  One more question.  If I have a value in a custom field that contains spaces, I cannot seem to get the values to match.  I get a invalid value exception.

        Ex custom1:Tom Bird

        how do I format that? --custom "custom1:Tom Bird, 'custom2:Matt Smith' "

        or --custom "custom1:"Tom Bird", 'custom2:"Matt Smith"' "

        Thank you

        Brian

        1. --custom "custom1:Tom Bird, 'custom2:Matt Smith' " or --custom "custom1:Tom Bird,custom2:Matt Smith" should work. The parameter custom needs to have the value double quoted as it contains blanks. The inner single quote is only necessary if the value contains a comma (since it is a comma separated list of values).

  8. I have a Custom Field of type version picker that I am trying to query with the action getFieldValue. It returns a value but it is the numeric id of the version in the field. I am trying to find a way using the CLI to get the string version for this field instead of the numeric value or to query the versions in a project to match the numeric to string vaue for the version in the custom field. Is this possible? I can't seem to find a way. I tried using the option --asVersion to see if that would work but it still returns the numeric id of the version from the project. Any pointers would be appreciated.

    1. Dale, sorry, must have missed your update. Just an oversight on my part - should be able to get both the id and the name. Please create an issue and it can probably get into the coming release.

  9. How do I specify an "- Automatic -" assigneee so that the component Lead will be assigned?

    1. Do not specify the assignee parameter or use --assignee -1. Of course your project must be setup to route automatic assignment to your component lead.

      1. Thanks, its working now!

        I found a configuration issue in my project but you confirmed what I thought.

  10. Hello

    I am trying to update the cascade filed using the jira client , looks like it is only updating one filed but not the second field.

    Here is how i am trying

    jira -s http://localhost:8180/jira -u adminuser -p adminpassword --action updateIssue --issue "PLAY-123"  --custom "customfield_10005:13624,customfield_10005:1:13697"

    Is updating cascade filed supported from command line ?

    Thanks

    Ravi

    1. See this comment. Create an issue for each field type that you need that doesn't currently work.

  11. Hello Bob,

    I use the JIRA CLI to create projects in JIRA. createProject let's me set the project lead and the permission scheme for a newly created project.
    Is there also a way to set :

    • a Field Configuration Scheme?
    • an Issue Type Screen Scheme?
    • a Workflow Scheme?
    • remove a group from the project roles?
    • add a group to the project roles?

    And if it is not possible trough the JIRA CLI, do you know another way to set those things automatically?

    Thank you very much,
    Thomas

    1. The problem is that the current SOAP API only supports the currently supported createProject values (issue security, notification, permission, ...) and does not have other support. This means it is a lot more difficult to support other options. The CLI now has some REST like support based on specific needs. Write up an issue(s) for those items that are most important. Or you use curl or try to mimic one of the rest like approaches in the source and add the needed function.

      1. Bob,

        I looked into cURL and was able to automate the creation of JIRA projects including the field configuration scheme, issue type screen scheme, workflow scheme as well as setting/removing groups. Thank you very much for your tip.

        If anybody else is looking into using cURL with JIRA, I recommend having a look at this page.

        Cheers,
        Thomas

        1. I've been asked whether I could share my cURL script. Even thou cURL is slightly of topic in this discussion, I decided to post the script here.

          Of course the script will most likely not do what you need, but you'll get some ideas. In order to adjust the script and find the right URLs for the tasks you want to automate, I recommend using Firebug, Chrome or Safari.

          The batch script needs two parameters:

          • The first one is the ID of the JIRA project you wish to modify.
          • The second is the group ID of the group you want to associate with the project role "Users".

          I hope this helps...
          Cheers,
          Thomas

  12. Unknown User (dave maheshwari)

    Hi,

    I am able to successfully create this issue from command line but I would like to use --file option to create, how do I specify it? The file Option given below does not work, I was hoping it will pick up from the file & remaining options from file

    Command Line

    File Option

    Actual File on Disc

    Thanks

    Dave

    1. The docs are not very good for this. The file parameters (in this case) can be used to provide a description. A description can be quite long, so a file option was important. The file is read as simple text to represent the description field.

      1. Unknown User (dave maheshwari)

        Bob,

        So there is no way to provide summary and other custom fields from the file?

        Thanks

          1. Summary - no
          2. custom fields - yes, use setFieldValue
          3. Next release there will be a facility to run actions directly from a file - see ACLI-13, ACLI-14.
  13. Can you specify an http URL for the source of the "--addAttachment" switch?

    1. No, but that is not a bad idea.

      1. I found a VBScript that works quite nicely for downloading the attachments from a website.

        LINK: http://www.ericphelps.com/scripting/samples/BinaryDownload/index.htm

        Here's the script just in case this website drops off the face of the planet.

  14. I'm running the following command and getting a "java heap" error.

    --action addAttachment --issue "BPP-689" --file "D:/Inetpub/_attachment_temp/niceday.wmv" --name "niceday.wmv" --findReplace "xxx:yyy"

    The permissions on the folder are set to "Everyone" and "full control" and the file itself  is only 1007KB, just less than a megabyte.

    Also I noticed that "findReplace" is a require attribute, but I'm unsure what place in the quotes since I do not need to replace any text.

    And I added the name attribute just to see if that made a difference.

    Any ideas?

    1. I've moved the details of this Issue to Jira bug database.

      https://studio.plugins.atlassian.com/browse/JCLI-73

      :)

      1. Please report problems with a jira issue instead of a comment (smile). Include plugin, jira version, and other information like the attachment. Regarding findReplace, it is not required - the error in the documentation will be corrected next release.

        1. Thank you for all the great work, Bob!

          I'm looking forward to the version 1.6 release.

          Do you have a rough guess-timate when that will be?   :)

          Also, do you have some kind of donation home page?

          1. Thanks! Hope to with next couple of weeks. Cleaning up a few issues and packaging with the other CLIs. I don't accept donations, but please donate to Room to Read.

  15. Bob,

    Another question for you. I am using the progressIssue action which allows the --custom optional parameter to set custom fields. One of my custom fields is of type Version Picker and I am trying to set that field using the following options --custom "Custom field:LOAD_2.0.54" --asVersion. This is complaing with the following error. Remote error: com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.issue.customfields.impl.FieldValidationException: Version Id is not a number. Does the --asVersion not work with this action and the --custom option? Just wondering?

    1. One other thing I have noticed now. I have looked up the version string of the new version I want to set. This custom field sometimes has an existing version id in it and I want to add the new version and keep the existing version resulting in two or more versions for the field. Doing the following

      --custom "Load First Included:'13831,20444'" --asVersion    results in the following error again

      Remote error: com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.issue.customfields.impl.FieldValidationException: Version Id is not a number ''13831,20444''

      I also tried

      --custom "'Load First Included:13831,20444'" --asVersion and it gave the following error

      Remote error: com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.issue.customfields.impl.FieldValidationException: Version Id is not a number '13831,20444'

      Thanks for your help

    2. You need to use setFieldValue and asVersion in this case. Then it will know to treat the field as a version field. And the comma separated list of versions should work as you expect. I don't think there is an option to add to existing, create an issue if you need that improvement.

      1. The problem is that I am trying to update a field tracking when a bug is built into a release build. This issue could be in the Closed status therefore I added a transition that when run transitions from Closed to Closed but allows me to update the field. Therefore I wanted to use the progressIssue action to set the custom field. I will have to rethink this then.

        Thanks

        1. Write up an issue. I don't know off hand how to determine if a custom field is a version field or not. Will have to investigate.

  16. I'm having trouble accessing issues, and I'm at a loss as to why.

    I get the following debug output:

    
    

    C:\JIRA-C~1.0>jira.bat --server=https://jira.test.com --user=userX --password=passwordX --action getIssue --issue EFC-3619 --debug

    Bob Swift details in JCLI-75

    1. Please create an issue with JIRA and CLI release details, etc.... Also comment what other actions work or not. Thanks.

  17. Can some one help me.

    for some reason the below code does not set the fix version on the ticket, the code does not error out.

    jira -a createIssue --project "SupportZone" --type "Bug" --summary "Test CLI issue " --priority "Medium" --components "Core Functionality, FAQ" --description "CLE test issue description" --fixVersions "3.12.2" --custom "Parent Ticket:JRA-205"

    I am on 3.13.2 jira enterprise.

  18. Hello everybody ,

    This could be real dumb question.

    I have batch file with multiple action commands on after another, when I run the batch , only the first  statement gets executed.

    looks like I missing something, where I can turn off  the return value coming from executing the first statement and continue with the rest of the statements

    A quick response will be very helpful

    EX:

    jira -a createIssue --project "SupportZone" --type "Promotion" --summary "Test CLI issue" --priority "Medium" --components "Core Functionality,FAQ" --custom "Parent Ticket:JRA-212,Promotion Job Id:101"
    jira -a createIssue --project "SupportZone" --type "Promotion" --summary "Test case 1 " --priority "Medium" --components "Aligne Issues,Compliance Reports,Build and Package" --custom "Parent Ticket:JRA-216,Promotion Job Id:102"
    jira -a createIssue --project "SupportZone" --type "Promotion" --summary "Test case 1 " --priority "Medium" --components "Aligne Issues,Compliance Reports,Build and Package" --custom "Parent Ticket:JRA-216,Promotion Job Id:103"
    jira -a createIssue --project "SupportZone" --type "Promotion" --summary "Test case 1 " --priority "Medium" --components "Aligne Issues,Compliance Reports,Build and Package" --custom "Parent Ticket:JRA-216,Promotion Job Id:104"

    1. It is likely that the program "jira" is a .bat or .cmd script, which is causing control to transfer to that batch file; it never returns, by design.  If you use "call jira" instead of "jira" (on every line), then it will return to your script after invoking it.

      1. Thank you very much it worked .

        - Dinesh

  19. Hello Everybody,

    I am trying to link  to issues and CLI throws an error.

    code :   call jira -a linkIssue --issue "JRA-234" --toIssue "JRA-212" --link "Link promotions"

    error :  Remote error: Invalid link type. Perhaps you have no link types configured?

    I am able to do the same operation using the GUI, and I do have link types setup.

    please help.

    - Dinesh

    1. We tried using the CLI for this but decided to pretend to be a browser instead.  Likely our implementation will break when we upgrade, which we have plans to address.  If you're using Perl, just use WWW::Mechanize (or WWW::Mechanize::Gzip, we needed it but not sure if it was for Hudson, JIRA, Nexus, or Sonar), and Google's Chrome browser to easily inspect the form (any browser allows "view source"; we have had great results with Chrome's ability to "inspect element" etc).  Then write the Perl code to do a specific GET which creates the link.

      Looking at our code, it turns out we just used LWP::UserAgent.  Here's the code block we have that walks through the bugs we want to link to the ticket, and links them one at a time; the fourth line is a comment showing how to properly form the "create a link" URL:


      1. Ken , Thanks for the quick response.

  20. How can I insert an issue with a custom field that has multiple values and which excepts multiple values like a "Multi Checkboxes" custom field?

    This is an example of the "Multi Checkboxes" field.

    FYI, I'm running Jira 3.13 and version 1.5.0 for the CLI plug-in.

    1. Custom fields with multiple values are not currently supported. See JCLI-77 for instance. Check if you field type is mentioned in any similar issue and if not, add a new issue for the support.

  21. Hello,

    first big thanks to Bob Swift for this tool :) .

    I currently write a excel macro to create with the information stored in excel an issue. I would like to pre fill some fields to get the latest values and to avoid input errors. Therefore I would like to get a list of all possible values from a custom field. While I tried to create a prototype for my excel sheet I have seen that when I try to fill out a custom field with the wrong value there appears an error that contains all possible values. My question is can I perform a request wit the CLI to get the list without performing a create issue and or try to catch the error massage from the command line?

    Thank you

    Ludwig

    1. Please create an improvement request to track this.

  22. Hey Bob,

    Eagerly awaiting the new version - seems to be a bit delayed?  Perhaps an update of the release date is in order...

    So far RC1 seems to be pretty stable!

    1. (sad). Yes it is caught up in other inter-related software releases. Continue to use rc1 until all that gets done. Probably not before Oct.

  23. BOB -- quick question is it possible to get more then one field value using getFieldValue action ?

  24. Hi

    I am tring to update a custom field but I want to append a value to the field and not replace the current field value with a new one

    how can I do that ?

    Thanks

    N.

    1. Other than your script getting the current value, appending, and then setting, there is not specific support. Create an issue describing exactly what you would like to see.

  25. Thanks Bob

    have an additional Q

    what should be the syntax to run the command including the connection to the server from command line, trying the below result in error

    .....java -jar release/jira-cli-1.5.0.jar --server http://localhost:8080 --user xxx --password yyy

    there is a syntax error on the user/pass

    also if the password include ! it seems to create a problem from cmdline can this be worked around ?

    Thanks

    N.

    1. Should work fine unless your userid or password contain special characters that result in command syntax error.

  26. Hi,

    1) Is it possible to use the command line is order to excute a filter with a result of excel file that includes the filter results

    2) how can I determine the output fields I will see when using getIssueLis, the output I get includes the below, can this be modified ? 

    Key, Id, Project, Status, Priority, Assignee, Reporter, Created, Date due

    Thanks

    N.

      1. getIssueList with filter parameter. Result is a csv file which can be imported into excel.
      2. Currently there is only one output format for getIssueList. Write up an issue if you have other requirements. Also, you can use getIssueList to produce a file and use a script to process each line to get more issue details.
      1. Thanks Bob,

        can you pelase give an example of how to use the getIssueList with filter parameters that results in csv file

        Thanks

        N.

        1. Search for getIssueList on this page for an example.

  27. I was using the plugin successfully and then left it for a few weeks. when I tried again, using the same queries (it was saved in a script for testing), I now get xml errors of the form:

    Remote error: ; nested exception is:
            org.xml.sax.SAXParseException: Premature end of file.

    Remote error: ; nested exception is:
            org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.

    (different xml error depending on which filter issue I ask for).

    We are using Jira 4.1.2 but according to our admin, it hasn't changed since I first tried successfully.

    Bob Swift - stack trace removed.

    1. Please open an issue for this type of thing (stack traces, etc...) verses commenting here. Also include your command line. This type of error looks like a server issue. It seems like you are doing a getIssueList function which will generate different results after a week of activity. Narrow your search down to isolate why it worked before and not now.

      1. ok, sorry, yeah that stack trace is a bit big here!-P

        I was hoping it might be something user related, but I guess ending up with a stack trace is a bug in one way or another.

        It was a getIssueList command, and I used the same filter at first. Yes, the data changed on the server since then since it's an active server. I tried different filters both with small results (3 issues, and large) and got variations of xml error messages.

        I'll open an issue.

        Peter

  28. When creating a new issue, I didn't see a way to set the "Original Estimate" field to enter a time estimate.  Is this available?

    (Great tool, by the way -- thanks for all the work you put into it!)

  29. I am new to Jira and trying to fetch all the issues created created in project "XYZ" how can i write the command to do this?

    I tried executing the following command <shown bellow> and getting error. 

    Jira CLI version : 1.5.0

    ./jira.sh --server https://localhost --user vinayakm --password ca\$hc0w123 --action getIssueList --filter "all"

    Client error: Filter 'all' is not valid

    Please let me know the available filter options.

    1. You need to create a filter all or whatever name you like to use on the --filter parameter. This needs to be done through the JIRA UI.

  30. Hi, I'm trying to add issues with the following features:

    • multiple custom fields: Story Acceptance Critera, Story Additional Info, Story #2
    • one custom field name has a pound sign in it
    • custom fields have spaces in the names
    • each field is a text field and has line breaks, commas, and single quotes in it.

    I understand that the standard pattern is --custom "fieldname:value, fieldname2:value" ....

    but how do I use escaping to handle my cases above – I'm kinda at my wit's end.

    1. Should work, but there is a bug (JCLI-106) with text containing " \n " not being converted to new line for a custom field value. It can get messy. It is cleaner if you use individual setFieldValue actions plus this allows taking the field value from a file which avoids a lot of nasty issues with command line syntax with quotes (especially on Windows) and handles standard line breaks. However, if you are using the custom parameter, then the following example applies (example will be included in next release documentation as it is now a testcase). The help text to refer to is:

       [--custom <custom>]
          Custom fields - comma separated key:value pairs. Key can be field name
          or id. Single quote the key:value pair if it contains a comma (,)
      

      Example

      --custom "custom1:xxxx, 'custom three:''aa#'',bb \n cc \n ^^^dd^^^' " --findReplace "^^^:\""
      
      1. Multiple fields are handled by comma separated
      2. pound sign should not matter
      3. blanks in custom field names should not matter
      4. fields with line breaks, commas, and single quotes - are handled
        • line breaks - hard to do from command line, " \n " should work once JCLI-106 if fixed
        • commas - must use single quotes
        • single quotes - must be doubled within a single quoted string
        • double quotes - may cause problems with your command processor (Windows (sad)), the standard way to avoid this to use setFieldValue with a file or findReplace as the example shows

      Fyi: 2.0.0 provides ability to run actions from file which can avoid various command line issues with special characters. A 2.0.0-snapshot release is eminent with a final release to follow.

      1. Thanks Bob,
        I will try this Monday.
        I will also try replacing the line feeds with the wiki line break macro – two back slashes. This appears to work in the atlassian confluence and jira instances. I have also added this into your JCLI-106 bug here.

        I've put a watch on JCLI-106   also so that I can move to that when it's available.
        For editing, using two backslashes is a kludge--however if a user runs thru the rich text plugin a couple times (at least in confluence), it puts the forced linebreak on a line by itself, so the incredible never ending paragraph effect can be avoided (smile)

  31. Hi Bob!

    CLI doesn't understand such custom as customfield_11111:2:33333.

    I've opened an issue. Waiting for your response. Thanks.

    https://studio.plugins.atlassian.com/browse/JCLI-108

  32. I like having all my scripts in a single location, sometimes sym linking to it as necessary.  As such, I changed the jira.sh to be able to be invoked form anywhere, including via sym link.  Contents are:

    #!/bin/bash
    #Figure out where this distribution is
    #Stolen from
    # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-in/179231#179231
    SCRIPT_PATH="$

    Unknown macro: {BASH_SOURCE[0]}

    ";                                                                                                                             
    if([ -h "$

    Unknown macro: {SCRIPT_PATH}

    " ]) then                                                                                                              
      while([ -h "$

    " ]) do SCRIPT_PATH=`readlink "$

    Unknown macro: {SCRIPT_PATH}

    "`; done                                                                                                                                        
    fi                                                                                                                                            
    echo "$SCRIPT_PATH is where I'll look"
    pushd . > /dev/null                                                                                                                           
    cd `dirname $

    ` > /dev/null                                                                                                      
    SCRIPT_PATH=`pwd`;                                                                                                                            
    popd  > /dev/null
    # Comments
    # - Customize for your installation, for instance you might want to add default parameters like the following:
    # java -jar `dirname $0`/lib/jira-cli-2.0.0.jar --server http://my-server --user automation --password automation "$@"
    java -jar $SCRIPT_PATH/lib/jira-cli-2.0.0.jar "$@"
    #!/bin/bash

    #Figure out where this distribution is

    #Stolen from

    # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-in/179231#179231

    SCRIPT_PATH="$

    ";                                                                                                                             

    if([ -h "$

    Unknown macro: {SCRIPT_PATH}

    " ]) then                                                                                                              

      while([ -h "$

    " ]) do SCRIPT_PATH=`readlink "$

    Unknown macro: {SCRIPT_PATH}

    "`; done                                                                                                                                        

    fi                                                                                                                                            

    echo "$SCRIPT_PATH is where I'll look"

    pushd . > /dev/null                                                                                                                           

    cd `dirname $

    ` > /dev/null                                                                                                      

    SCRIPT_PATH=`pwd`;                                                                                                                            

    popd  > /dev/null

    # Comments

    # - Customize for your installation, for instance you might want to add default parameters like the following:

    # java -jar `dirname $0`/lib/jira-cli-2.0.0.jar --server http://my-server --user automation --password automation "$@"

    java -jar $SCRIPT_PATH/lib/jira-cli-2.0.0.jar "$@"

    1. Could you create a How to page as a child page of How to with this information please? Surround with a {noformat} macro. Thanks for your contribution.

  33. I'm having trouble getting login tokens to work. Maybe I'm confused, or maybe our installation doesn't allow this? Here's what I've tried so far:

    % ./jira.sh --action login --user username --password password > token
    % ./jira.sh --action getIssue --issue PNC-487 --login < token
    Error: Parameter 'password' is required.
    
    % cat token
    p55ir6wYcL
    

    I can connect and interact if I provide a username and password on the command line:

    % ./jira.sh --action getIssue --issue PNC-487 --user username --password password
    Data for issue: PNC-487  (45550)
    
    Issue key . . . . . . . . . . : PNC-487  (45550)
    Type  . . . . . . . . . . . . : Functionality Question (13)
    Status  . . . . . . . . . . . : Closed (6)
    .
    .
    .
    

    So the fundamentals are working - I can connect and get an issue. The login token part of this is where I'm failing.

    If it helps, our JIRA install is v4.2.2-b589, and I'm on a Mac, OS X 10.6.7.

    Aside from this one hurdle, which is likely my fault, or our installation, your utility is awesome and has improved my workflow tremendously.

    1. You want -l to get it from standard input.

      [-l|--loginFromStandardInput]
              Get login token from standard input.
      
      1. Ah. Ok, that makes sense. Unfortunately, same error:

        % ./jira.sh --action getIssue --issue PNC-487 -l < token
        Error: Parameter 'password' is required.
        

        Any idea what is generating the error? Is that being passed back from JIRA or is that from the java side? The exit status is 254, which I don't see listed as one of your exit codes:

        % ./jira.sh --action getIssue --issue PNC-487 -l < token
        Error: Parameter 'password' is required.
        % echo $?
        254
        
        1. Sorry, I was distracted by the other error. password is a required parameter. You can set --password "" for any action that just requires the login token and a valid one is provided. Non-SOAP based actions require a password and a few long running actions require a password to handle token timeout conditions that require a new login. So requiring a password all the time is a (perhaps confusing) simplification! Other notes:

          1. Consider using the run actions for sequences of commands in automation - it handles the login token automatically and performs better than you doing externally
          2. If you are concerned about password visibility, put the password in the jira.sh file
          3. The error codes are Windows based, add 256 for Unix type systems (254 = -2).
  34. Is it possible to use the JIRA CLI client with https:// URLs?

    I can't seem to connect to our internal JIRA servers (which do have the RPC plugin installed) through CLI using my Windows credentials.

    Thanks,

    David Bono

    1. Yes, but depending on your client you may have to do some certificate configuration. Check JIRA for some solutions - example https://studio.plugins.atlassian.com/browse/CSOAP-70

  35. I can´t figure out how to get attachments with whitespaces in their names. I have tried the following:

    java -jar release/jira-cli-1.5.0.jar --server https://servername:8081 --user username --password pword --action getAttachment --issue GTWO-558 --file "c:\jiracli_150\attachments\GTWO-558\name with spaces.docx"

    java -jar release/jira-cli-1.5.0.jar --server https://servername:8081 --user username --password pword --action getAttachment --issue GTWO-558 --file "c:\jiracli_150\attachments\GTWO-558\namewithoutspaces.docx" --name 19275

    I get error below:

    Client error: Error reading attachment data,
    java.io.IOException: Server returned HTTP response code: 505 for URL: https://servername:8081/secure/attachment/192
    75/name with spaces.docx?os_username=username&os_password=pword

    Jira version is 3.13

    1. Please create issues for things like this.

      1. You need to review what 505 means - http://www.checkupdown.com/status/E505.html
      2. In general, I don't support 3.13.x any longer
      3. 3.13 had various attachment issues, I think 3.13.3 was likely the best for remote support in the 3.13.x line
      1. OK, this was a one-timer for migration. Issue was solved as example below:

        curl --insecure 'https://servername:8081/secure/attachment/19275/name+with+spaces.docx?os_username=username&os_password=pword'  --output attachments/GTWO-552/name+with+spaces.docx

  36. Excellent work, Bob!
    Could you explain runFromSql in a sub-page? Does this substitute select fields into a script template, iterating over the result set?

    1. Yes, it does need a more detailed page. For now, see Atlassian CLI Release 2.0.0

  37. Bob, thank you for amazing tool, it helps us a lot!

    A little question. Is possible to get a list of Fix Version/s and Affects Version/s? We need this for give the user the possibility to select multiple fix/affects version/s that shall correspond to the ones that are provided in Jira.

    Thanks in advanced.

    1. Yes it is possible to get a list of versions, but it is not implemented. Good idea! Please create an issue.

      1. Thank you Bob, I've just created an issue - JCLI-140. By the way, how can I achieved for now this behavior? Is it any SOAP provided by Jira? and then may be editing jira-soap project with this? 

        Regards.

        1. Code already committed to bitbucket. Hope to have an official 2.1.0 distribution soon (within a week).

  38. Hi Bob!

    Is it possible to delete user from all groups within one command (jira, confluence)?

    1. No, not unless you use removeUserFromGroupWithFile. Feel free to write up an issue.

  39. Hi Bob, am performing some tests on how to update an issue by changing the field "status" ie (from open to closed or from resolved to closed). I am having problems on the syntax. Can you please advise if this is possible? Cheers.

    1. That is a workflow transition, therefore you need to use progressIssue. See examples on this page.

      1. Oh.. that's Brilliant! Found some samples and can now perform the work transition through command line. Thanks for the quick help.

  40. Hi Bob,

    I did some testing based on the following example provided above:

    The "comment" option is not mentioned in the cloneIssue usage:

    And it appears to have no effect. I am not sure if this is a bug or a documentation issue.

    Regards,
    Jon

    P.S. - It does not complain about the "comment" flag but if I change it to "comments" I get an error. If I run it with -v the URL requested contains no reference to the field.

    1. I was intended to be added in 2.1.0, so the testcase was partially updated - that is what generates the example documentation. Forgot to finish that (sad). Support added to 2.2.0 - JCLI-148.

  41. Another question:

    When using the cloneIssue action, is there any way to control the status? For instance I may want to clone an issue that is in progress, or closed - but I want the clone to start from the beginning of the workflow. I would be tempted to argue that starting at the beginning of the workflow should be the default behaviour.

    1. That is a more difficult question (smile)! The CLI is just doing the JIRA action at this point. You could start a discussion with the Atlassian community on what are common scenarios and/or default behavior. While it might be possible for the CLI to do additional processing after the fact, it would make more sense for the base function to support the most important scenarios from both the UI and also from the CLI. The most likely approach to implement (in a timely fashion (smile)) is as a feature request to the Clone Plus Plugin for JIRA.

  42. Hi Bob,

    Does this new version has the capability of retrieving all the fields or a sub-set of fields (esp incl. comments field) of a Jira issue? I think we were discussing about this when you released the prev version. I wonder if you have included it in this new release?

    1. Yes, see JCLI-103. comments are getCommentList.

      1. I can't get "--outputFormat 2" working for me. Do I need to specify the format somewhere before using it? or should it automatically pick up all the fields?

        For me its still the same fields: Key, Id, Project, Status, Priority, Assignee, Reporter, Created, Date due

        1. Make sure you are using 2.1.0 client. If it is still a problem, open an issue with details like command line and output using -v.

  43. Hi, Any chance on getting the tool to update user details - such as email address?   Our standard user removal policy is to pull the user from all groups and then change the email address to <email>.inactive  to ensure bounces on any subscriptions etc.  Is updating this field viable via the soap?  If so, I'm Ok being-the-solution and sending a patch in for review.

    Thanks, it's a great tool

    Peter

    1. No SOAP interface, but I think it can be done another way. Please create an issue now. I am working on a number of other changes for a major release, so should be able to add one more. Thanks for the offer, but, probably not a big difference for this one by the time I integrate and write tests. You could help by verifying this (and other) changes in the distribution prior to release (smile).

      1. Hi Bob,

        I submitted JCLI-158 and I'm happy to help however I can. Thanks

        Peter

      2. Hi Bob,

        Do you have a doc on setting up a build environment?  The update user feature is great.  The only problem I seem to have is that I want to get group membership for the user.    I figure I'll take a stab at scratching-my-own-itch and submitting a patch.  

        Can you point me to a setup doc if you have one because I'm hitting some dependency problems.

        Thanks

        Peter

        1. Developer Information. All requirements should be in Maven. Discuss there if something missing. Regarding user support for group, see my comments on JCLI-88.

          1. Hi Bob,  I'm all set.  It was the optional gant part of the install goal that caused my problem.  While I can build I now understand what you were saying.  There's no access point to the data I want at this point.   So, I'm stalled unless I use another technology to routinely update my scripts knowledge of groups.  At this point I think working on LDAP integration seems the more fruitful approach and waiting for the RESTful interface to be released.

            Thanks for all the help.

            Peter

  44. Hi Bob! We have upgraded to Jira 4.3.3.

    I have problems with filling customfields to workflow. Before upgrade it worked fine. Now it says : "Custom fields cannot be validated. Use correct custom field ids!"

    jira --action progressIssue --issue XX-123123 --user xxx --password xxx --server "xxx" --project "xxx" --step "Update Information" --custom "customfield_12352:Done"

    1. It is only a warning given because the user does not have administrator rights needed to validate custom field names with JIRA. If the custom field is correctly specified by id (your example looks ok), then it should work as normal. Did the custom field get updated or not? If not, run the command with an admin user and verify the field validates correctly. If you still have problems, open an issue with more details and we can discuss there.

      1. "Warning: user is not an administrator" was before and everything worked fine.
        JCLI-161 opened.

  45. Dear Bob,

    Thanks again for such a pretty tool. I have a little question about the license BSD that you're using. With this license, do I have the possibility to take your code and changed it for my purposes? If it is, do I have to include the same copyright information you included at the top of every source code?

    Best regards.

    1. Yes to both questions.

  46. Hi, 

    To download the attachment of JIRA , we used to give like 

    jira --action getAttachment --issue %issuenum% --file %attachedfile%    ( here we should specify the attached file name )

    But , My program has to download the attachment automatically , when i specify the JIRA Issue number

    Can you please tell me , is there any way ?

    Regards,

    Harish

    1. getAttachment will automatically copy the attachment data to the file specified on the file parameter.

    2. HI Bob, 

      I want to download all the attachments of JIRA.  I found only getAttachmentList is giving the list of attachments . 

      Is there any way to download all the attachments in a single shot without specifying any name of the attachment.

      Regards,

      Harish

      1. Not currently. Open an issue to get all attachments for an issue.

  47. How do I move an issue from one project to another?

    1. Move is not supported by JIRA SOAP or newer REST APIs. Recommend you create a JIRA improvement request. In the meantime, you can use the cloneIssue CLI action to a new project provided you have Clone Plus Plugin for JIRA installed. Then use deleteIssue to remove the old issue.

      1. I found an existing request for this functionality which has been closed as 'Won't Fix' (JRA-16494). Guess I'm out of luck on that front.

        I'm actually doing a clone and move, and have considered the Clone Plus plugin, just haven't had time yet to do the testing/experimenting required before deploying a new plugin. I'll work around the limitation for now with some manual follow-up steps, and hope to switch to using Clone Plus later.

        Thanks.

  48. How can I use --autoVersion with the Jira Command Line Interface and --runFromCsv?
    I want to import issues from a CSV file using the command line interface.

    This command line creates the issue and adds the version if necessary.

    jira --action createIssue --autoVersion --project "IMP" --type "task" --summary "Test" --fixVersions "3.999"

    But if I want to run it from a csv, I cannot get the right syntax. This is what I tried:

    action, project, issue, Type, issue Type, summary, Date, assignee, description, fixVersions, autoVersion
    CreateIssue, IMP, ,task, bug, "Test Summary",31.10.2011, Brenk, "Test Description",   3.2,

    This gives the error "Version '3.2' is not valid for project with key: IMP"

    So how should I specify this parameter --autoVersion in a csv file?

    1. Use --common "--autoVersion" on the runFromCsv command for now. This will apply to all rows. Row specific switch settings are missing - JCLI-169.

  49. Is there way to add value to custom filed ? for example if i have custom filed stage is there way i can add multiple values ( for admin side not on users side) via command line.

    1. setFieldValue action for setting a custom field value or updateIssue for setting multiple standard and custom fields.

  50. Is there a way to change the parent of a subtask? I need to copy a subtask and move the copy to a different parent.

    1. No, there isn't a way to do this. Please open an issue.

  51. I wanted to resolve an open issue and set the resolution state to Completed.

    The result is: "Successfully progressed issue: PI-3429  with step 'Resolve Issue'".

    But the resolution field is not changed and remains "Unresolved".

    Am I missing something?

    1. The only thing I can think of is that the resolution field must be on the resolve issue transition screen (otherwise JIRA ignores the update) although this is normally the case. Go to the UI with the same user id and verify. If you still have problems, open an issue with more details including running the action with -v.

      Another way to check if JIRA is ignoring the field is to use an invalid value and see if JIRA responds with an error, if not, JIRA is ignoring it.

      1. Thanks a lot, Bob!

        The whole transition screen was missing.

        After restoring it, the CLI ran fine.

  52. Hi Bob,

    I do have installed JIRA clone plus plugin however while using action cloneIssue assignee and environment are only changed for Parent JIRA task and not sub task? I want to changed for "cloned" parent JIRA Task and all it's sub task please advise how we can go about this.

    Thanks,

    Ameya

    1. Currently not possible. Please create an improvement request for Clone Plus Plugin for JIRA to provide option to copy parent assignee to subtasks similar to the option to copy versions.

  53. Thanks for that Bob.Yep, shall create an improvement request for plugin.

  54. Improvement request created @ [https://studio.plugins.atlassian.com/browse/JCPP-39]

    Cheers,

    Ameya

  55. Hi Bob,

    Using the updateVersion action there is an "--after" to specify the version it follows, how would I move a version to the top of the list? Can a --before or --first or something be added?

    Thanks,
    Jon

    1. Use -1 - it documented in the after parameter help.

      1. Dagnabbit, I looked and did not see it... until now.
        Thanks Bob!

  56. Bob, thanks for a great product and your work.

    Quick question: I'm having trouble using the runfromsql action with MS SQL Server. I tried connecting using both the driver:

    and URL methods:

    I have put the JTDS jar (jtds-1.2.5.jar) into the lib/jdbc directory. I also tried specifying the port number. But I always get the following error:

    Can you please help? I'm running on Win 32 with Java 1.6 and JCLI 2.2.0

    Thanks

    Ben

  57. Hi Bob, thanks for the great support on this tool!

    I'm trying to use the CLI (v2.2.0) to create an issue which has some required fields which are configured with default values. It seems that the default values are not applied until after the checking for required fields is done, since I'm getting errors saying that these fields are required. Is that true? Do I have to specifically set values for all required fields even if they are configured with default values?

    1. I confirmed this is the way JIRA seems to work. The documentation says:

      the default value of the custom field when it is first displayed to a user.

      So when an issue is created via the remote API, the required fields must be provided as it seems the default values are only used for the initial display shown to users. The whole notion of a required field having a default value seems rather odd to me in general.

      1. I see your point. These required fields didn't originally have default values - I added them in the hopes that I would then not have to specify them in this script I'm working on. :) But I guess that doesn't work, so I may change the configuration back.

  58. Hi!  I need to do custom field values updates for many bugs for a project.  I'm running the following command with the global-admin user which also is has project admin and developer roles.  I seem to get an error when trying to update issues not created by myself.

    Example of an issue update created by myself:

    $ ./jira.sh --action setfieldvalue --issue "xxx-337" --field "Custom1" --values "someValue" --field2 "Custom2" --values2 "someValue"
    Issue xxx-337 updated.
    $ ./jira.sh --action setFieldValue --issue "xxx-4" --field "Custom1" --values "someValue" 
    Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: Fields not valid for issue:
    Errors: {}
    Error Messages: [You do not have permission to edit issues in this project.]
    $ ./jira.sh --action setfieldvalue --issue "xxx-337" --field "Custom1" --values "someValue" 

    Issue xxx-337 updated.

    Example of update on an existing issue created by someone else:

    $ ./jira.sh --action setFieldValue --issue "xxx-4" --field "Custom1" --values "someValue" 

    Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: Fields not valid for issue:

    Errors: {}

    Error Messages: [You do not have permission to edit issues in this project.]

    I've also tried using updateIssue and see the same outcome.  It doesn't quite make sense that I can only update issues that I create.  I should be able to update any issues as the global admin and project admin.  What am I missing?

    Any assistance would be appreciated!

  59. Verify the same user can do the update via the ui.

  60. Hi there,

    first, awesome little tool! 

    But since I can not set the "Estimated Time" (why is that anyway?), I have to clone a bunch of Issues and update them via a perl script. Works fine so far but when I try to delete the link between the original and the clone (--action deleteLink --issue ISS-new --toIssue ISS-src --link "is cloned by") there is a positiv feedback ('is cloned by' link deleted between ISS-new and ISS-src) but the link is still there. Any idea?

    regards

    Steven here wants the estimated time as well! ;)

    https://studio.plugins.atlassian.com/wiki/display/JCLI/JIRA+Command+Line+Interface?focusedCommentId=50659519#comment-50659519

    1. Please create an issue with your details and output of the delete link command with -v option. Regarding estimated time see JCLI-98.

  61. I've gotten great use out of this tool, thanks a million.

    However, I need to update summary, description, and custom fields with values that contain commas, single and double quotes, and line breaks.  I've poured over the docs and comments, and experimented for many hours.  If you could give examples of all of them in one consolidated explanation, I'd appreciate it greatly.  Your answer might look something like this:

    ------------------------------------------------

    To update a field so that it contains the following two-line value:

    Here's how to count:

    The names of the first three numbers are "one", "two", and "three".

    The "updateIssue" arguments for a standard field such as Description:

    --action updateIssue --issue "XYZ-123" --description ..........

    The "updateIssue" arguments for a custom field such as "Custom1":

    --action updateIssue --issue "XYZ-123" --custom ..........

    ------------------------------------------------

    By the way, I'm using "--action run" and a file to contain a bunch of these, if that matters.  Also, I'm running your utility on Mac OS X, if that matters.  Thanks again!

    1. It is very confusing because of the different behavior and escaping rules of the various pieces including command line differences (Windows and non-Windows). Here is a quick summary:

      1. Windows and non-Windows command processers have various special characters and considerations for escaping that I can't get into here
      2. The command line parsing (JSAP library) used by CLI:
        • requires double quote (") around any value that contains a blank. Embedded double quotes must be doubled.
        • doesn't care about single quotes
      3. CLI defines some parameters (like custom) that are values that are parsed as separated lists of values (think CSV and the rules for that - the best reference is The Comma Separated Value (CSV) File Format)
        • normally the separator is comma (,)
        • normally the quote character is a single quote (') that is used for values that happen to contain the separator character or new line characters
        • embedded single quotes within a quoted string must be doubled
      4. custom happens to be a comma separated list of colon separated values, so it is twice as complicated
      Icon

      Use the newer fieldn and valuesn parameters on create and update to help eleviate the difficulties with custom at least for a couple of fields.

  62. Any ETA on the 2.5 release ? (Thanks for JCLI-100 ! )

    1. No, but you can use the snapshot (see link at top of page). Snapshots are normally available and include any resolved issue. Snapshots pass all automated tests, but tests may not be run against all releases. New functions may still need more tests added before release.

      1. Ok, thanks ! Missed the link here, as I came from the plugins.a.com page. Cheers !

  63. Hi, we're running into a very strange problem and am hoping you can help. The issue is with linking issues from the command line. We've done some testing with User A and User B.

    User A can:

    • create tickets using the command line, search for tickets using the command line
    • link tickets using the UI

    User B can:

    • create tickets using the command line, search for tickets using the command line
    • link tickets using the UI
    • link ticket using the command line

    User A can't, however, successfully link tickets using the command line. It says that it was successful ("Issue x blocks y", but the tickets aren't linked. We test User A and User B on the same machine with the same setup (i.e. we just change the username and password in jira.sh and User B succeeds but User A fails sneakily). I saw a post about using a port number being the fix for this, but I suspect this isn't the case here as User B succeeds at this with the same setup. We played around with all sorts of permission schemes and tried this from several different machines, but we can't seem to get User A to create tickets using the command line. We're pretty stumped here. Any ideas?

    (This is the command I'm using)

    ./jira.sh --action linkIssue --issue x --toIssue y --link "blocks"
    1. Review JCLI-219 and install the snapshot to see if that resolves your issue. If not, create a new issue with detailed output (-v --debug) from the command.

      1. Thank you for your quick reply. I tried installing the snapshot and it didn't fix anything. I then ran it with the -v and --debug flags, and when I was going through the output removing my password, I discovered the problem. The password for User A had a "#" character in it, which was showing up in some spots but not others in the --debug output. Changed the password and it is resolved. My apologies if you had already noted somewhere in the documentation that certain special characters in passwords weren't supported in the CLI.

        1. Ah... good find (smile). Special characters in passwords causes problems for some functions that are not SOAP based (sad). Not well documented although there are a few discussions/issues where that problem is highlighted.

          1. Good to know! Yeah, it did strike me as strange that I was still able to use other functions with that user. Didn't realize that some functions use SOAP and some don't.

            1. Atlassian is no longer improving the SOAP APIs in favor of the new REST APIs. Those APIs are incomplete as well. So the JIRA CLI uses whatever API is available to accomplish the task including some direct url scraping in areas where neither API is sufficient (linking is one of those (sad)). Gradually, proper REST APIs use will replace those once the APIs are improved. CLI clients should be shielded from most of this change under the covers. But there are some annoying ramifications like this at least for now.

          2. We escape special chars in passwords with "\" and that seems to do the trick. eg.

            abc\#defg
            1. That is good to know (smile). I might be able to do more automatically but there are lots of special cases dealing with special characters and escaping on command lines (Windows and not-Windows) as well as URL escaping.

  64. Not sure if I'm missing something but I feel like there should be an outputFormat that is just the issue key alone with no headers.

    I wanted to add a new fix version to a bunch of issues in an iteration, and I had to do this fugly thing:

    Perl or something wasn't an option as it was for a business user...

    1. I need the same outputFormat – but you are one step ahead of me... where are the outputFormats documented?
      I have seen reference to outputFormat1, outputFormat2, outputFormat200 but don't know what they do.

      1. I can't remember if/where they're documented, I just tried a few different ones.

        My fugly kludge didn't even work properly in the end because of fields with multiple lines. So I just got the user to paste the id column from the query results in excel to a text file and loop over that.

        I suppose the direct db access is a solution, but not for me as I was trying to give this to a user.

        I guess someone should create an RFE for this...

        1. Valid output formats are documented here - Documentation (last column). You pretty much have to try them to see the exact details of what is included (sad). Regarding the earlier question, runFromSql is the currently (2.4.0) supported way to do that. The good news is that 2.5.0 will have runFromIssueList to allow a query or filter to produce the issues for each action - see JCLI-226. There is a snapshot with the support.

  65. Hi Bob, thanks for this great tool. Just 1 question - with getIssueList, how do I get the number of issues only, without any of the issue details?

    I know you can just look at the first field of the output where the number is stated, and it works well if the number of issue is low. But when there are many issues, it takes forever to load all the issues details which I don't need.

    If it is currently not supported, is there any way to modify your code to achieve this?

    Thanks

    1. The number of issues is given on the first line of output. If you don't want to see the output, use the file parameter to put that to a file. On unix you can use --file /dev/null or windows use --file NUL

      1. Hi, I know you can hide the the output visually, but what I am asking is: is there a way to change the return type of getIssueList from a List to an Integer?  

        That way, the size of data it returns can be dramatically reduced (KBs vs 8Byte). 

        1. Good point. No, not with the current support that uses SOAP. Also the new REST APIs have a similar problem I think. Suggest adding a request to improve the REST APIs to support this and then eventually can be a higher performing option.

  66. Hi Bob,

    Is it possible to query through CLI the same way we do in JIRA say for example list of all issues which are not closed for my id.

    Also at the stage I am not sure what kind of quieries can we run through --sql option.

    If i run in sql file query like

    OR

    I am getting error like

    The command I ran is as follows:

    ./jira.sh --action runFromSql --file "sql_scripts/1.sql" --host "tmeldb04.transurban.com.au" --driver "oracle.jdbc.driver.OracleDriver" --database "CINF3CTL" --url "jdbc:oracle:thin:@tmeldb04:1721:CINF3CTL" --dbUser "jira42" --dbPassword "XXXX" --user aagashe --password XXXXX

    Am I going wrong anywhere?

    Please assist.

    Thanks.

    Ameya

      1. You can use getIssueList action to use JQL to find a set of issues
      2. The runFromSql action is for doing an action for each row returned from the sql. You have to have a valid sql query that produces the action or set of fields used to create an action. select * does neither.
      3. In the coming 2.5.0 release, you can do the equivalent of runFromSql with runFromIssueList using a JQL query instead - see JCLI-226
  67. Hi Bob.

    Is it possible to export XML file from search queries with JIRA CLI?

    1. No. Create an improvement request.

  68. Hi Bob, thanks for the great job you did there.

    I'm trying to use the JCLI to let users progress their issues through the workflow over another Interface, so I'd like to use an "automation"-user to log in to Jira but have the action performed by the specified user. After reading your help output from jira.sh I assumed that the --assignee "testuser" option would make this, but it didn't change anything at all. I'm using Jira v4.4 and try typing the following command:

    It does progress the issue correctly - but only if it is assigned to automation before and it is not assigning it to "testuser" after that. I also tried the command above with myy admin user login - no change.
    So what I'm looking for is a way to perform actions as other users, even if the automation-account needs administrator rights for this.

    Can you help me there? It's not so convenient to have 3 entries in the History: Assigning to automation, Progressing the Issue and Reassigning to the User.

    1. The underlying JIRA APIs the CLI uses only allows you to do actions that are allowed by your workflow! And only update fields that are available on the corresponding screen. To do what you want, you need to define workflow steps that (perhaps) only the automation user account can do, since you probably don't want normal users to do. For instance, normally (without customized workflow) only the issue assignee can progress an issue from open -> start progress. This is what you are seeing. So, just add a specific workflow step for what you want to do and make sure assignee is on the corresponding screen.

      1. Thank you very much, I really appreciate your fast help!

        Sounds like a very good idea and the possibility to implement this, thank you.

        If I do so, would you expect the command I posted above to give me the required result?

        Thanks a lot!

        1. Yes, in our environment we have a number of workflow steps that allow automation to do various activities that cannot be done by normal users. This is especially needed when integrating and synchronizing with external products that have different workflows.

          1. Okay, thank you very much!

  69. Hi,

    when I use the JCLI for some issues like

    I get the following error message.

    This happens only for issues where the column TIMEORIGINALESTIMATE in database table JIRAISSUE is not null.

    What can I do to set the value for a custom field for theses issues too?

    Any help would be greatly appreciated.

    1. It is likely you cannot update the issue using the UI either until the invalid field is fixed. The error you are receiving is directly from JIRA. Is time tracking active? Or was time tracking recently turned off? You may need to consult with JIRA support.

      1. Hi Bob,

        timetracking is active. Thanks for your answer.

      2. Hi

        I have the same error in createIssue action. I have't found the way how to avoid it.

        jira --action createIssue --project "ISUPPORT"  --type "3"    --field "customfield_10250" --values "10286" --summary "Consulting" 

        I tried next variants:

        --field “timeoriginalestimate” –values “0”

        --field “timeestimate” –values “0”

        --field “timespent” –values “0”

        Remote error: com.atlassian.jira.rpc.exception.RemoteValidationException: Customfield ID 'timespent' is invalid.

        So how I can specify a value for time timetracking via cli?

        1. I assume you are talking about the standard time fields and not a custom field. The timeSpent and estimate fields can only be set/changed using the addWork and updateWork actions. See also this comment.

  70. Is there a way to use "getIssueList" to only display the columns that I want it to display or write to the CSV? At the moment, it includes the description of the ticket in the CSV and more often than not, there are line breaks in it that basically makes a mess of the file. It becomes difficult to parse.

    Basically, I want to be able to get a list of ticket keys (done via search with specific due date), and a couple of its custom fields. I've tried runFromIssueList but that is not viable for attempting to run the action getFieldValue as that requires a specific issue to be inputted.

    1. There is no column selection option. You can write up an issue for an enhancement. It is a standard CSV format that could be parsed by standard csv libraries. If you are a Confluence user, the csv macro has column selection as well.

  71. Bob, I am trying to update the description field with update from a file: something like

      jira --action updateIssue --issue "ZJIRACLI-3" --description "append text" --appendText

    But I want to use --file option to add the contents of a text file to the existing description. Can i do it?

    Can I do it?

     

    1. Yes, should be the same as using the description field.

  72. How can I assign a ticket to myself with the cli. Creating and closing are fine. Start Progress fails because I am not assigned but I can not assign myself. The response indicates it works but the assignee does not change.

    jira --action updateIssue --issue "TEST-123" --assignee $USER
    Issue TEST-123 updated.

    1. Make sure you can change the assignee from the UI update issue screen. If not, JIRA does not allow it from the remote API nor does it say that it didn't update it (sad).

      1. Thanks Bob, but the credentials that I access JIRA with do have the ability to assign people, infact I am an administrator of the server. What else could be wrong with this command:

        java -jar [DIR]/lib/jira-cli-2.5.0.jar --server https://OUR_DOMAIN --user [myusername] --password [mypassword] --action updateIssue --issue TEST-123 --assignee [myusername]

          1. Make sure the assignee field is on the UI screen and you can change it! Is not as much an authority question, but, whether the screen allows it.
          2. Verify other fields can be set with the command ok.
  73. Bob - is there any way to "addWork" on behalf of another user? I extract worklogs from another system with their usernames attached, but I don't know the individual user's password - but I have an 'automation' account with whatever permissions I need. So I'd like the 'automation' account to be able to 'addWork' to JIRA on behalf of the specific user.

    I think Fisheye does this by reading the SVN commit logs (looking for #time ...) so it must be possible - any thoughts?

    P.S. The function of the --role and --group options for 'addWork' are somewhat less than clear - what impact does that have on the worklog added?

    P.P.S. Thanks Bob for an extremely useful tool!

    1. P.P.P.S. I just noticed JCLI-38, which isn't specifically about 'addWork' but sounds like it might apply - yes? Any target date?

      1. See JCLI-38 and related for discussion of this.

        role and group are visibility of the entry per normal JIRA capabilities.

  74. I tried associating a WorkFlow scheme to a project and it worked only when the destination workflow was similar i.e. same issue types and workflows (basically to a copy of associated WorkFlow Scheme). I then tried with one added workflow to the copy of workflow scheme, it did not work. However, the CLI showed that project has been successfully updated..

  75. Open an issue (issues tab) with the details including JIRA version, command line used, and output of the command with the --debug option

  76. Hello, does this plugin allow me to create versions (addVersion) to multiple projects in the same command?

     

    I tried putting two project names seperated by a comma, and I got an 'Unexpected Argument' error.  I can insert one just fine, but I need to add the same new versions to all of my projects,

     

    jira --action addVersion --project "Bridge", "Metrics Support" --name "Release 75"

  77. No, use 2 separate commands. Also, be aware of the run action for running a set (file) of actions.

  78. When using commands such as addUserWithFile I do not see how to format the file that is past to this command.  I see the example file which is included with the download but I would like to see a description of the format of the file in the documentation or the help.

    So if an action takes the file paramter for input there should be a description of how that file is formatted.

  79. Hi, I'm having some trouble using the addLabels/removeLabels command.  The action seems to complete successfully, no errors are reported back, but the action does not actually take place. For example:

    $ jira --action getFieldValue --issue "KR-1089" --field "labels" 
    Issue KROME-1089 has field 'labels' with value:
    Pre4.0_Failure
     
    $ jira --action removeLabels --issue "KR-1089" --labels "Pre4.0_Failure"
    Labels removed.
     
    $ jira --action getFieldValue --issue "KR-1089" --field "labels" 
    Issue KROME-1089 has field 'labels' with value:
    Pre4.0_Failure
    
    

    Your help is most appreciated, and thank you very much for such a useful plugin.

    1. Make sure that labels can be updated from the UI for the issue and the same user. JIRA only allows update of fields that are editable via the UI and gives no error otherwise.

      If you still think there is a problem, open an issue (issues tab) and specify JIRA release, CLI release, and output of the removeLabels action with the --debug parameter.

  80. Thanks Bob, I did make sure to use the same username in the CLI and UI. The UI works fine, I will open an issue with the output of the --debug parameter

  81. I was hoping to automate creation of projects, but I met several obstacles:

    • Can't specify an IssueTypeScreenScheme. Saw that there was an earlier request for that.
    • Can't specify a category.
    • Can't set an avatar. (can live with that)

    So I need to visit every project after creation to make the additional config.

    I was never successful to set the IssueTypeScheme. I tried with both id and name and got the following output:

    Remote error: 'Default Issue Type Scheme' not found as a issue type scheme.
    or
    Remote error: '10000' not found as a issue type scheme.

    The other configurations only worked with the name. For example --permissionScheme "10131" returned "Remote error: Permissionscheme '10131' not found" but --permissionScheme "XX Permission Scheme" worked fine.

    Using Jira CLI 2.6.0 on Win7 and JIRA version is 5.0.2

  82. Hi Bob,

    I am trying to fetch filter results but getting NullPointerError. Attached is the exception for your reference. Am i doing something wrong here?Exception.txt

    Here is the command that i am executing:

    jira --action getIssueList --file "C://JIRA CLI//issueList.txt" --filter "JIRA Open Issues" --outputFormat 999 --debug

    1. Pranjal, it is a remote error - meaning that the server is having a problem with the request. This means it is most likely a server error.

      1. Check your server logs to see if there is any information that can help you 
      2. Restart JIRA - sometimes this has been known to solve server issues
      3. Check that you do not have any customized SOAP related plugins that may be interfering with normal SOAP operations
      1. Hi Bob, i don't see any logs in the system. Where else can i check?

        1. Your JIRA logs are usually in your JIRA home directory under logs.

  83. Hi Bob,

    I am having some trouble in assigning an issue to my team member. When I run the command the output comes "Issue ABC-123 updated" with no error but in actual it is still assign to same person as before. Actually this command runs fine in all issues but this time I am running in different project, this project have different workflow like it contains a screen in workflow action (eg) when you hit resolve button it shows a screen with options "Resolution" and "comment". I am posting that commands which I have tried.

     

    • $jiracli/jira.sh --server $server --user $username --password  $password --action updateIssue --issue $j --assignee "user1"

    " Output : Issue ABC-123 updated " but in actual it does not.

    Your help is most appreciated, and thank you very much for such a useful plugin.

    1. Mohammad, normally that means that the UI screen for updating this issue does not allow the assignee to be changed. The JIRA remote APIs do not allow fields to be changed unless they can be changed from the UI. The remote API does not report an error, it only ignores the input :(. So, you need to update your screen to include assignee.

  84. Hi Bob,

    I had a question  – I'm in the not so enviable position of trying to import issues from an old version of JIRA (4.1) — to the current version — in chunks. JIRA doesn't seem to support an easy way to import deltas.

    Long story short, I was thinking of scripting something. Perhaps look at the xml for each issue, and build a csv file from that. And then import the csv via your tool.

    One thing I am trying to verify – if I use the import from csv option, will I be able to indicate a status (closed, resolved, whatever) – or will I have to progress the issues through a work flow?

    I ask because it seems that Jira's native csv import allows you to indicate status upon import?

    I wanted to thank you for your cli tool - I already use it for sever automation tasks. It is, as they say, "The Bomb." (smile)

     

     

  85. You will need to use progressIssue to get it to the right state (sad). It was just a few months ago I went through a similar type of situation - Migration from Plugin Studio. I turned out good in the end, but was a bit of a pain and not something I would like to do often (smile)

  86. Hi Folks,

    I simply would like to return more than one field value from a query.

    I've not found anything obvious in the examples.  

    Basically, something to the effect of this hypothetical syntax.

    jira.sh --action getFieldValues --issue "ZJIRACLI-3" --fields "assignee","summary"

    Please tell me I'm missing something basic.

    Thanks.

    1. Both getIssueList (csv format) and getIssue (formatted text) will get multiple fields. 

  87. Hi Bob,

    I am trying to update the worflowScheme of a project already created in JIRA using the following command

    jira.sh --action updateProject --project APTEST --workflowScheme "New Test Workflow Scheme"

     

    but I get the following error although the mentioned workflow scheme already exists in JIRA

    Client error: Invalid request: javax.net.ssl.SSLProtocolException: handshake alert:  unrecognized_name


    Would you be able to help me debug and fix this issue?

    Thanks.

    1. See if the tips in this help. That is adjust the server name you are using or employ the workaround (-Djsse.enableSNIExtension=false) in your jira.sh.

      1. That worked. Thanks!

  88.  

    Hi Bob,

    In our production setup, We have a integration between Stash and JIRA. If I go to source tab of any JIRA issue, I can see the list of files committed by a user towards a perticular JIRA issue.

    Is there a way to get files committed for a perticular JIRA issue using JIRA CLI ?

     

    Thanks & Regards

    Shravana Kumar

    1. Good question! No, but, there are Stash APIs for retrieving this information and it would be a good addition to Stash Command Line Interface. Please open an issue and I will see if it can be done for 3.7.

  89.  

    Hi Bob,

    Is it possible to create a custom field using JIRA cli ?

    Thanks

    1. No, JIRA does not support this in the remote APIs currently.

  90. Hi Bob,

    How do I export the data of few fields out of many fields for a given project using JIRA CLI ? Please advise.

     

    Thanks

  91. Hi Bob,

    I have problems to update text fields in JIRA (multi-line text field). I read the information from csv and several input columns are with multi lines. Only I do not get multi-line updates in JIRA.

    The csv file has the contents:

    Issue, Values
    DEMOREQ-6,"Line 1.
    Line 2"

    The command I use:

    jira.bat --action runFromCsv --common "--action setFieldValue --field "CustumTextField" --file test.csv

    I get an output report:

    Issue TST-6 updated.

    But only the first line is in the JIRA text field. Any idea?

    1. I can't seem to reproduce this on either Windows of unix. Are you sure CustumTextField is defined as a free text field?

      1. I played around with the character encoding, now the problem is fixed.

        But I can also not reproduce it anymore.

        Anyway; job done, thanks for the fast response.

         

  92. Hi Bob,

    Is it possible to 'Add Attachment' in 'create Issue' action without writing 'add Attachment' action separately.
    As of now i am doing automation of creating issue and then add attachment.But every time i have to provide Issue id of newly created issue.
    So it would be great if can add attachment to lastly created issue directly.



    1. No, but, that would be a nice improvement. I created JCLI-488 for you. We do have a few other actions that do some extra things after the fact. The difficulty is error handling and parameter overlap. For instance, createIssue already uses the file parameter.
      In the meantime, are you aware that you can use the run action to run 2 actions at once where the second action can automatically get the last issue key created using @issue@ substitution value?
       

      1. Thanks Bob for your quick response.
        And that run action is really helpful for me and does exactly what i want. I was running @issue@ parameter in second separate command so it was not working. Thanks for your great suggestion.