Forums

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

Need Query & Rest API Endpoint on retrieving the issue keys

Bondili, Pushpitha Bai November 1, 2024

Hi All,

My Scenario is:: I want to retrieve all the issues that are having the custom field (Alert ID Hex) and its value as "Alert ID Hex = ABCD" and status as "Cancelled".

To satisfy the above case i used the below endpoint and JQL query.

URL:  https://neustar-sandbox-375.atlassian.net/rest/api/3/search?

Method: Get

Payload:: 

jql=project=OneDev AND customfield_10651 = ABC AND status=cancelled&fields=key

 

But in the response, i couldn't see the issues.

Could you please correct me with the payload and any other required changes to all the issues that matches with the case? 

I want to get only the issue keys and apart form this i don't want any other data to be populate in the response code.

 

1 answer

0 votes
Jeroen Poismans
Community Champion
November 1, 2024

Hi,

Unfortunately what you' re asking is not possible in the API. Even when asking for only field=key, you will always get a response like this:

{
"expand": "schema,names",
"startAt": 0,
"maxResults": 50,
"total": 105,
"issues": [
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "10166",
"self": "https://xxx.atlassian.net/rest/api/3/issue/10166",
"key": "SOLV-35"
},
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "10165",
"self": "https://xxx.atlassian.net/rest/api/3/issue/10165",
"key": "SOLV-34"
}
}

The roor json object contains a json array issues. Each issue is an object with minimum some fields (expand, id, self, key). Should not be difficult to parse though.

Hope this helps!

Jeroen

Bondili, Pushpitha Bai November 1, 2024

Hi @Jeroen Poismans ,

Thanks for your response.

Do you mean to say that it will populate all the field details? Or only those details that you shared as below will be populated.

"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "10165",
"self": "https://xxx.atlassian.net/rest/api/3/issue/10165",
"key": "SOLV-34"

Could you please confirm if the endpoint and query that I have provided are valid? or do I need to make any changes to get the response just like you shared?

 

Jeroen Poismans
Community Champion
November 1, 2024

What I shared is the minimum fields you will always get returned. You can get extra fields by providing them in the fields parameter. Omitting the fields parameter will give you the issue with all custom fields. 

Your endpoint is correct and the JQL also seems valid too.

Jeroen

Suggest an answer

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

Atlassian Community Events