...
First command above uses an argument to specify an issue. The second command uses a flag to specify an issue.
Repeated Flags
Sometimes a flag can be repeated multiple times. Both of following examples are valid and do the same thing.
Code Block | ||
---|---|---|
| ||
jira worklog:get-worklogs --worklogId=18900 --worklogId=18901 --worklogId=18902 |
Code Block | ||
---|---|---|
| ||
jira worklog:get-worklogs --worklogId=18900 18901 18902 |
Boolean Flags
Boolean flags have usually a default value and you don’t need to specify it when it has a default value. Yes no for boolean flags are specified with ‘--no’ prefix.
Code Block |
---|
--notifyUsers
--no-notifyUser |
Date Flags
Most of the time Date Flags/Arguments can be specified in two ways. Following examples specifies the same instant in time.
UNIX timestamp in milliseconds. Example: 1524815284277
ISO 8601 string format (YYYY-MM-DDThh:mm:ss.sTZD). Example: 2018-04-27T07:48:04.000+0200, 2018-04-27T07:48:04.00-0230
The part specified with + is timezone information. The part specified with . is milliseconds part.
Help
You can use ‘--help' to see all available arguments and flags for a command.
...
--extended may show extra columns which are normal hidden. Since there may be a lot of information to fit the width of the screen by default some commands may not show all the columns by default. For example nearly all tables includes a ‘self’ column which contains URL of the entity. This is very long and occupies a lot fo space on the screen and may cause lots of columns to be truncated. For this reason ‘self’ column and some other columns are hidden by default. You can specify --extended flag to show these columns.
Here is our general recommendations on when to use which output format:
table: This is the default format and suitable for human eyes especially if all the columns of output fits to width of the terminal and there are multiple rows of data. For example when getting list of users.
Code Block | ||
---|---|---|
| ||
jira project:get-all
Id Key Name Project Type Key Archived
10001 ACN Accurate Notebook software false
10005 ADS Adaptable Summer software false
10008 AUC Auxiliary Card software false
10006 CLG Clean Guardian software false
10004 COI Compressing Interface software false |
yaml: Prefer this format when there are a lot of columns and it is difficult to fit all columns on the screen. Especially when displaying a single row of information.
Code Block | ||
---|---|---|
| ||
jira server-info:get --output=yaml baseUrl: 'http://localhost:8080' version: 8.14.0 versionNumbers: - 8 - 14 - 0 deploymentType: Server buildNumber: 814001 buildDate: '2020-11-23T00:00:00.000+0300' databaseBuildNumber: 814001 serverTime: '2021-01-06T12:36:45.790+0300' scmInfo: ab08d3d2b500818bdad5c85d636b509d4cade801 serverTitle: Jira Server |
json: Prefer this format when writing integrations and scripts. It is suitable for hierarchical data too.
Code Block | ||
---|---|---|
| ||
jira issue:get ERP-53 --output=json { "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations", "id": "12705", "self": "http://localhost:8080/rest/api/2/issue/12705", "key": "ERP-53", "fields": { "issuetype": { "self": "http://localhost:8080/rest/api/2/issuetype/10000", "id": "10000", "description": "Created by Jira Software - do not edit or delete. Issue type for a big user story that needs to be broken down.", "iconUrl": "http://localhost:8080/images/icons/issuetypes/epic.svg", "name": "Epic", "subtask": false }, "timespent": 21600, "project": { "self": "http://localhost:8080/rest/api/2/project/10000", "id": "10000", "key": "ERP", "name": "Enterprise Resource Planning", "projectTypeKey": "software", "avatarUrls": { "48x48": "http://localhost:8080/secure/projectavatar?pid=10000&avatarId=10203", "24x24": "http://localhost:8080/secure/projectavatar?size=small&pid=10000&avatarId=10203", "16x16": "http://localhost:8080/secure/projectavatar?size=xsmall&pid=10000&avatarId=10203", "32x32": "http://localhost:8080/secure/projectavatar?size=medium&pid=10000&avatarId=10203" } }, "fixVersions": [], ...... } |
Issue ID or Key
Most commands that expects an issue can either accepts an issue ID or key. In that case this flag is usually ‘issue’ and you can use either ‘--issue=10000’ or ‘--issue=TEST-1’ to specify issue. If a command explicitly needs issue ID the flag will be ‘issueId’ and if a command explicitly needs issue key, the flag will be ‘issueKey’.
...
Running Commands as Another User
Info |
---|
Only available for DC or Server versions of Jira |
When adding a site to CLI, you provide an Atlassian account credentials or username for running commands. Normally all commands run as this user but sometimes you may want to run a command as another user. Some Jira APIs doesn’t allow a to specify a user for an action but some APIs allow a user to be specified. For example when adding a ‘Vote’ for an issue, you can’t specify which user voting so it always uses the user you have specified when adding the site. But when adding a ‘Watcher’ for an issue, API allows you to specify a user as watcher so you can make another user watch the issue other than the user you specify when configuring the site. Very similarly you can’t specify a user when adding a comment to an issue or when logging work to an issue.
...