APIs Queries

vipin_gupta February 9, 2020

Hi,

I am using Jira APIs (https://ict4dprojectservices.atlassian.net/rest/api/2/search?jql=) to get information out of the system and have the following questions.

1. Max result set size is 100, how can I increase the size.

2. I am not able to get comments related to issues, using APIs.

3. How can I get the attachments for the issues?

Thanks,

Vipin 

 

1 answer

1 accepted

0 votes
Answer accepted
DPKJ
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 10, 2020

@vipin_gupta  Welcome to the community!

Here is answer as per your question,

  1. Max Result for JQL issue search API can't be more than 100 (it is max set by Atlassian), so if you want to fetch more data, you need to use startAt in combination with maxResults parameter.
  2. To get comments, you need to pass parameter named 'fields' with value 'comments'.
    • fields=comment&fields=summary
  3. Similar to comments you can also add attachment to fields,
    • fields=comment&fields=attachment
vipin_gupta February 10, 2020

Thank you for the prompt reply, very useful.

Another question regarding startAt parameter.

I am using URL

https://ict4dprojectservices.atlassian.net/rest/api/2/search?jql=order%20by%20created%20DESC&maxResults=100&startAt=0&fields=comment&fields=attachment&fields=summary

I am getting below message.

Start At 0.jpg

This means I am getting 498 issues. So when I will set startAt parameter as 5, I should get empty response. But that is not the case, I am getting data with startAt parameter as 5

https://ict4dprojectservices.atlassian.net/rest/api/2/search?jql=order%20by%20created%20DESC&maxResults=100&startAt=5&fields=comment&fields=attachment&fields=summary

Please advice how to use startAt parameter so that code can end the loop.

Thanks,

Vipin

DPKJ
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 10, 2020

'total' in response here means total number of issue that your query satisfy.

So, for maxResults=100&startAt=0 query your response,

  • Here you are getting first 100 issues (starting from 0) out of total 498 issues

for maxResults=100&startAt=5

  • Here you will get 100 issues out of total 498 starting from 5th issue

You can take 'total' as maximum size of array and 'startAt' as starting index from where you are fetching sub array.

vipin_gupta February 12, 2020

Thanks DPK. This is so helpful.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events