Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Search API with JQL is not returning the attachments

sadhana.chittibabu September 29, 2023

Hi 

I am trying to retrieve the issues those are returned by JQL using search API,

https://intelligenceapp.atlassian.net/rest/api/2/search 

Method : Post

Post data: 

{
    "jql":"project = 'xxx' and issuetype='xx'
}

however that returns all the fields except the attachment field.

But I am able to view the attachment 
https://intelligenceapp.atlassian.net/rest/api/2/issue/{{key }} API.

Could anyone tell me what's wrong with this.

Note: I have added the Attachment fields in Field configuration and screen as well

1 answer

1 accepted

1 vote
Answer accepted
Hannes Obweger - JXL for Jira
Atlassian Partner
September 29, 2023

If I remember correctly you need to explicitly specify the fields for this to work. Try adding

fields=attachment

to your request.

Best,

Hannes

sadhana.chittibabu September 30, 2023

yes, that works for me but since I am getting JQL result as a response I wanted to get the attachment for all the issues the API returns.

To acheive that currently I am looping the response and requesting the retrieve issue API by specifying the fields=attachment the params which is time consuming.

It would be better if I can get the attachment while requesting the below API

https://intelligenceapp.atlassian.net/rest/api/2/search 

Method : Post

Post data: 

{
    "jql":"project = 'xxx' and issuetype='xx'
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events