rest/api/3/issue Get selected fields only

S March 25, 2021

Hi,

I'm using API to get all the open issues...

Is there a way to restrict the fields returned in response?

As of now, i'm getting all the fields in my response. I feel that's an over kill.

 

 

 

My sample code

  1. private static async Task SearchJira()
  2. {
  3. try
  4. {
  5. string apiUrl = @"https://URL/rest/api/3/search?jql=project=ProjectName&maxResults=10";
  6. using (var httpClient = new HttpClient())
  7. {
  8. using (var request = new HttpRequestMessage(new HttpMethod("GET"), apiUrl))
  9. {
  10. var base64authorization =
  11. Convert.ToBase64String(Encoding.ASCII.GetBytes("emailId:AuthCode"));
  12. request.Headers.TryAddWithoutValidation("Authorization", $"Basic {base64authorization}");
  13. var response = await httpClient.SendAsync(request);
  14. var jsonString = await response.Content.ReadAsStringAsync();
  15. var jsonContent = JsonConvert.DeserializeObject<JiraResponse>(jsonString);
  16. }
  17. }
  18. }
  19. catch (Exception ex)
  20. {
  21. throw ex;
  22. }
  23. }

 

 

1 answer

1 vote
Bill Sheboy
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 26, 2021

Hi @S 

Have you tried using the fields parameter:

https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/search

For example:

/rest/api/3/search?jql=project=myProject&fields=summary,key

 

Best regards,

Bill

Suggest an answer

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

Atlassian Community Events