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.
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.
Amir Katz (Outseer)
Technical Lead
Outseer, an RSA company
Israel
21 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
1 comment