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

Specify custom order of fields returned from JIRA REST API using cURL

Morgan Goodrich Jun 12, 2018

Hi,

I want to be able to specify the order of the fields returned from my JQL query. Some fields are custom fields and by default, they return in order of ascending custom field ID, which I don't want. I'm trying to output this to a spreadsheet, so I would like certain fields containing multiple entries to output to the last column, which avoids shifting all the other columns around.

My command is:

$ (curl -u user:'password' -X GET 'url/rest/api/latest/search?jql=project=KEY&maxResults=200&fields=summary,customfield_11003,customfield_11001' | sed 's/{"expand":/\\\n/g') > output.csv

I want this to output:

summary, customfield_11003,customfield_11001 in that order, i.e., not ascending by field ID.

Instead it outputs:

summary,customfield_11001,customfield_11003.

I've tried simply inputting the desired order, using the order by command, using various delimiters, and various combinations of the field command. I'd like to avoid renaming the custom fields, as that is not a viable solution for our team.

Any help is appreciated - thanks!

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev [cPrime] Community Leader Jun 12, 2018

Hello,

You can not specify an order. You should parse JSON programmatically and produce any order you need.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

1,814 views 3 15
Read article

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