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

Use curl in a Linux Bash script:



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.


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

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.

1 comment

Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 29, 2020

Recently came across this requirement and taking hint from this script, was able to extract just the custom fields:

Hope that helps:

# small script to CSV export Custom Fields
# Author: Mr. Doubt Everyhim
# Date: 2020-09-22

# Get all the fields:
curl -k -u ${admin_user}:${admin_password} -X GET -H "Accept: application/json" ${jira_server}${url_part2} \
 | jq '.' > raw_file.json
# Create to_entries:
cat raw_file.json| jq 'to_entries' > raw_key_entry.json
# Extract keys:
cat raw_key_entry.json | grep -B2 customfield_ | grep key | awk '{print $2}' | sed 's/,//g' > key_entries.txt 
# Extract ID, Name, Field Types:
for i in $(cat key_entries.txt); do
  cat raw_file.json | jq -r "[.[$i].id, .[$i].name, .[$i].schema.custom] |@csv" >> CF_details.csv
echo "Results are printed in: ./CF_details.csv"
Like Amir Katz (Outseer) likes this


Log in or Sign up to comment
AUG Leaders

Atlassian Community Events