Skip to Content
jira-cli

πŸ”Ž Search and metadata

Run JQL, find people, inspect what your instance supports and call any REST endpoint.

jira search 'project = ABC AND created >= -7d' --json | jq -r '.[].key'
jira count 'project = ABC AND status = Done'

search <jql> takes -n, --limit <n> (default 50) and --json. See Setup for the truncation exit code. count prints the number of matches.

People

jira whoami
jira whoami --permissions --project ABC   # global admin and project admin
jira user search ada --project ABC

user search <query> takes -p, --project <key> to restrict to users assignable on that project, and -n, --limit <n> (default 20).

Instance metadata

jira meta shows what your Jira supports, useful for getting names right before creating things:

jira meta issuetypes      # also: priorities, statuses, resolutions, linktypes
jira meta labels
jira meta filters
jira meta permissions ABC
jira meta server

Escape hatch

Anything not covered goes through jira api:

jira api /rest/api/3/myself
jira api /rest/api/3/issue/ABC-123/watchers -X POST -d '{"accountId":"..."}'
jira api /rest/api/3/issue/ABC-123 -X PUT --input body.json
build-body | jira api /rest/api/3/issue/ABC-123 -X PUT --input -

-X, --method defaults to GET, and -d, --data takes a JSON body. For a body too large for the command line, --input <file> reads it from a file and --input - from stdin; it is checked as JSON before anything is sent, and it cannot be combined with --data. A 2xx response with an empty body prints nothing and exits 0, so null only ever means Jira really answered null. A non-2xx response is an error and shows the body.

Scripting

Every read command takes --json, and colour is off when stdout is not a TTY or NO_COLOR is set:

jira issue list --mine --json | jq -r '.[].key'