user3591433
user3591433

Reputation: 115

Curl command to get single field from list of all JIRA issues using jira rest api

I'm trying to get list of all jira issues like this:

curl --globoff --insecure --silent -u username:password -X GET -H 'Content-Type: application/json' "http://ficcjira.xyz.com/rest/api/2/search?jql=project=ABC"

Like search?jql=project=ABC gives me a list of all the jira issues with all its fields. But, now I just want them showing only 1 field in them, i.e., "Timetracking" field.

How do I do that??

Upvotes: 1

Views: 1460

Answers (1)

Somaiah Kumbera
Somaiah Kumbera

Reputation: 7489

Just append "&fields=Timetracking" to the url, so your curl call would be :

curl --globoff --insecure --silent -u username:password -X GET -H 'Content-Type: application/json' "http://ficcjira.xyz.com/rest/api/2/search?jql=project=ABC&fields=Timetracking"

Make sure the field name matches the case. FYI - in my jira instance the field is called "timespent"

Note that you still get a bunch of JSON that needs parsing. Thats the nature of the beast when it comes to the Jira REST API - Responses are always in JSON.

If you want a nice slick way of parsing that json from bash, I suggest you look at jq (which I love) https://stedolan.github.io/jq/

Upvotes: 1

Related Questions