How to query on attribute from Json array object

Gaurav Sisodiya March 11, 2017
{
"expand": "renderedFields,names,schema,versionedRepresentations",
"id": "93451",
"self": "https://abc.jira.com/rest/api/2/issue/93451",
"key": "CORE-31360",
"fixVersions": [
	{
	"self": "https://abc.jira.com/rest/api/2/version/20213",
	"id": "20213",
	"description": "3.8.6",
	"name": "3.8.6",
	"releaseDate": "2014-08-13"
	},
	{
	"self": "https://abc.jira.com/rest/api/2/version/19814",
	"id": "19814",
	"description": "3.9.1",
	"name": "3.9.1",
	"releaseDate": "2014-08-13"
	}]
}

Here in this Json object I want to query on "name" attribute present under "fixVersions". How to write the curl or REST API. 

curl -D- -u username:password -X GET -H "Content-Type: application/json" https://abc.jira.com/rest/api/2/search?jql=fixVersions:name%3D3.8.6%20

Thanks in Advance.

2 answers

1 accepted

1 vote
Answer accepted
Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2017

Start look at the example at https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues

Your cURL should looks like this to JQL fixVersion 3.8.6

curl -D- -u username:password -X GET -H "Content-Type: application/json" https://abc.jira.com/rest/api/2/search?jql=fixVersions=3.8.6

Adding project ABC to the syntax

/rest/api/2/search?jql=project=abc+and+fixVersion=3.8.6
Gaurav Sisodiya March 11, 2017

@Niclas Sandström [Riada] Thanks Man that works for me !! Really appreciate your help.

Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2017

Hey no problem and happy I could help! Have a nice weekend.

0 votes
Quazi Faisal September 22, 2017

Guys ...need help :/

Suppose for an issue there are n number of worklog in worklogs. By JQL, how can I just retrieve the first element (recently updated worklog) from the worklogs json object?

Thanks 

Suggest an answer

Log in or Sign up to answer