JIRA Rest API select minimal resource

1.2k views Asked by At

I am using JIRA REST API for querying issues with below jql

jql=project =SLUB and "Agile Team" in ("Iris (B2C)")&fieldsByKeys=true&fields=status&maxResults=1

I am getting api response as

{
  "expand": "names,schema",
  "startAt": 0,
  "maxResults": 1,
  "total": 1172,
  "issues": [
    {
      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
      "id": "35988",
      "self": "https://xyz.atlassian.net/rest/api/2/issue/35988",
      "key": "SLUB-7071",
      "fields": {
        "status": {
          "self": "https://xyz.atlassian.net/rest/api/2/status/10200",
          "description": "",
          "iconUrl": "https://xyz.atlassian.net/",
          "name": "To Do",
          "id": "10200",
          "statusCategory": {
            "self": "https://xyz.atlassian.net/rest/api/2/statuscategory/2",
            "id": 2,
            "key": "new",
            "colorName": "blue-gray",
            "name": "To Do"
          }
        }
      }
    }
  ]
}

How can I only fetch status name instead of complete status resource. Please suggest.

1

There are 1 answers

2
Gaurav Agrawal On

https://docs.atlassian.com/jira/REST/latest/#d2e3181 Check This .

The fields param (which can be specified multiple times) gives a comma-separated list of fields to include in the response. This can be used to retrieve a subset of fields. A particular field can be excluded by prefixing it with a minus.

By default, only navigable (*navigable) fields are returned in this search resource. Note: the default is different in the get-issue resource -- the default there all fields (*all).

  • *all - include all fields

  • *navigable - include just navigable fields summary,comment - include just the summary and comments

  • -description - include navigable fields except the description (the default is *navigable for search)

  • *all,-comment - include everything except comments

Copied From Here.