Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why is my Jira Cloud REST API fields parameter not working as expected?

brant_brisson February 12, 2020

I am using our Jira Cloud instance REST API.  I am trying to get a specific history using the "Get Issue" endpoint using the "expand" parameter and the "fields" parameter... I am not getting the results I expected.  

Here is the https request:

https://{OUR_INSTANCE}.atlassian.net/rest/api/3/issue/DEP-513/?expand=changelog&?fields=attachment

I am getting the expanded results for this issue, but it is not limited to the 'field' = 'attachment' (I have tried this with the 'status' field as well).

Results:

{

  "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations,customfield_11200.properties,customfield_11201.properties,customfield_11623.properties,customfield_11611.properties,customfield_11610.properties",

  "id": "217696",

  "self": "https://[OUR_SITE].atlassian.net/rest/api/3/issue/217696",

  "key": "DEP-513",

  "changelog": {

    "startAt": 0,

    "maxResults": 32,

    "total": 32,

    "histories": [

      {

        "id": "871791",

        "author": {

          "self": "https://[OUR_SITE].atlassian.net/rest/api/3/user?accountId=5c93d734999a3f2d4cae93fe",

          "name": "anirban.roy",

          "key": "anirban.roy",

          "accountId": "5c93d734999a3f2d4cae93fe",

          "avatarUrls": {

            "48x48": "https://secure.gravatar.com/avatar/ca666241ff64a3790fbb0fc51483f143?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FA-0.png&size=48&s=48",

            "24x24": "https://secure.gravatar.com/avatar/ca666241ff64a3790fbb0fc51483f143?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FA-0.png&size=24&s=24",

            "16x16": "https://secure.gravatar.com/avatar/ca666241ff64a3790fbb0fc51483f143?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FA-0.png&size=16&s=16",

            "32x32": "https://secure.gravatar.com/avatar/ca666241ff64a3790fbb0fc51483f143?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FA-0.png&size=32&s=32"

          },

          "displayName": "anirban.roy",

          "active": true,

          "timeZone": "America/New_York",

          "accountType": "atlassian"

        },

        "created": "2020-02-11T22:07:21.332-0500",

        "items": [

          {

            "field": "Attachment",

            "fieldtype": "jira",

            "fieldId": "attachment",

            "from": null,

            "fromString": null,

            "to": "92913",

            "toString": "image-20200212-030713.png"

          }

        ]

      },

      {

... much more original content truncated ...

 

1 answer

1 accepted

0 votes
Answer accepted
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 12, 2020

Dear @brant_brisson ,

you have to use "&expand=changelog" without "fields" parameter to see the history

https://{OUR_INSTANCE}.atlassian.net/rest/api/3/issue/DEP-513?expand=changelog

So long

Thomas

brant_brisson February 12, 2020

Thomas, thanks for the quick reply.  You are saying the I cannot expand the output AND filter it for specific fields at the same time?

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2020

This is what I expect, but feel free to experiment with the upper URL. As it is a GET you can simply copy&paste into browser.

So long

Thomas

brant_brisson February 14, 2020

Thanks Thomas, I have tried that many times and have not been able to get it to work the way I would expect it to.  Will keep trying... this post was to:

1) Try and find someone who had made it work, or,

2) Try to fins someone who can tell me that it will NOT work.

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2020

Dear @brant_brisson ,

I checked it on my own and you are right. When "fields" is appended as a parameter, the changelog disappears.

I would say, this is the current implementation of the Cloud Rest API. There is nothing wrong. In the REST API doc following is written:

Note: All fields are returned by default. This differs from Search for issues using JQL (GET) and Search for issues using JQL (POST) where the default is all navigable fields.

So no need to add "fields=attachment" , its included.

If you think this is a bug or a limitation, have a look at https://jira.atlassian.com/secure/Dashboard.jspa and feel free tor raise a new suggestion or at lease request for correction of the API Doc.

So long

Thomas

brant_brisson March 4, 2020

Thanks Thomas!  I will consider this closed.

Suggest an answer

Log in or Sign up to answer