It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get list of all Jira server fields (system and custom) via REST-API

Use curl in a Linux Bash script:

#!/bin/bash

admin_user=fu
admin_password=bar
jira_server="https://jira.acme.com"
api_version=2
url_part2="/rest/api/${api_version}/field"

curl -k -u ${admin_user}:${admin_password} -X GET -H "Accept: application/json" ${jira_server}${url_part2} \
| jq '.' > raw_file.json

# Extract field names, remove double quotes, sort

cat raw_file.json | jq '.[].name' | sed 's/"//g' | sort > nice_file.txt

 

Note: There is a separate REST-API to get only custom fields, but it's not working for me at this time. I will update once I find a solution.

Updates

1. The REST-API for Jira Server does not support getting only the custom fields.

Your recourse is to check the "id" key in the JSON (the file raw_file.json). If the value is "customfield_nnnnn", it's a custom field. Or, even simpler, you can check the key "custom" which is "true" for custom fields.

2. When you view the fields in the Jira UI

    https://jira.acme.com/secure/admin/ViewCustomFields.jspa

there may be fields which are marked Not configured for any context under the Available context(s) column.

I've found out that the REST-API call does not retrieve these fields.

0 comments

Comment

Log in or Sign up to comment
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,647 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you