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

jira api calls

Khan December 23, 2020

Hi everyone,

My name is Khan and working as an automation engineer. Very happy to be part of this great community. I would like to share my knowledge and get your important feedback regarding automation topics.

I'm working on a confluence QA monitoring page for pulling jira data via api calls for about 50 product teams.

Details:
1. each product team data includes number of defects in production and sprint-wise. number of automation tests, functional tests etc.
2. around 7 api calls are needed for each team. Meaning 50x7=350 ajax calls are done during page load

Questions:
1. how do I include some waiting gif etc to show that parts of the page is being populated and user need to wait?
2. any optimization best practices?

UPDATE:

by this time, I've completed the monitoring page and have distributed the api calls in few loops. The total loading time for ~1200 ajax calls is ~1.5 minutes. My question remains open.

Many thanks

3 comments

Comment

Log in or Sign up to comment
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 23, 2020

Hi @Khan , welcome!

This is an interesting question. I'm interested in hearing some more details. First, some information gathering:

  • Are you using Jira and Confluence Server, or Cloud (URL ends in atlassian.net)?
  • How exactly are you adding these AJAX calls to your Confluence page? Is there an app you are using for a specific macro?

I'm curious if there's any chance of going from AJAX calls to using the built-in Jira gadgets in Confluence. For example, could you use the Jira issues macro to show results from a JQL search that included the issues and fields you were interested in showing? You mentioned test information - if that's available as a custom field on the issue, you could display it as a column in the Jira issues macro search results. I'd hazard a guess that the Jira macro will be significantly faster than trying to get the information manually. It also would take care of showing the loading information.

I hope that helps a bit, and am interested to hear more if that doesn't work for your case!

Cheers,
Daniel

Like # people like this
Khan December 24, 2020
  • using Jira and Conf server
  • AJAX calls are placed in macro:html and the result is populating html table dynamically
AJS.$.ajax({ 
url: `${JIRA_REST_URL}${INCIDENTS}${productTeam}${REP_DURATION}${MAX_RES}`,
type: "GET",
success: function (data) {
....

 I'm indeed not using any external tools. In short, a jql is encoded and then added to a jira-rest-api url and upon page load a call is made.

By now, I already have answers to my questions:

1. to use jquery to show waiting gifs etc
2. to avoid callback-Pyramid
3. to use jquery promises

@Daniel Eads Can you please give an example of a jquery promise?

Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 8, 2021

Unfortunately jquery promises are outside the scope of my expertise! I do see examples of them in the jquery documentation - but as I understand it there's nothing particularly different in using them with results from the Jira API than any other way you'd use them to prevent other functions from modifying your data while you're waiting for a method to finish.

Based on what you've mentioned so far though, it's possible you still might be able to utilize the Jira issues macro to list issues, rather than building from scratch. That would definitely save quite a bit of effort if the display format meets your requirements. Cheers!

Khan January 9, 2021

Thanks @Daniel Eads for you reply, I'm aware of the Jira issues macro, however the jira api calls suites better for my use-case.

I feel like this welcome-center group is not the place to ask for technical help or may be the Atlassian's developers are not paying attention to the welcome-center messages.

I'll ask again in Jira automation or confluence chat. Since my questions are still open. However thanks again to all for replying,

We can close this chat now.

Regards

Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2021

Hey Khan - I do want to set your expectations. You're asking for help with javascript development (jquery promises), not about something specific to Jira or Confluence. It's possible that someone will be able to help. But general javascript development is outside the scope of Atlassian Support. Atlassian's development team is not obligated or expected to answer questions like this.

We do have a lot of smart folks on the Community here - it is entirely possible that someone will answer a question like this, perhaps in the Jira questions section. But overall I would expect that Stack Overflow might be a better resource for a general javascript question. I hope that's useful to know - I do want you to get connected with the help you need but am worried that these questions might go unanswered even in another part of Community.

All the best,
Daniel | Atlassian Support

Like # people like this
Khan January 9, 2021

Thanks @Daniel Eads  A Stack overflow question already created. Please close this thread.

Cheers

Khan

Erica Moss
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 5, 2021

@Khan Welcome to the Atlassian Community! We're glad you're here. 😄

Khan January 6, 2021

Thanks @Erica Moss  :)

Any suggestions/optimizations regarding my question ?

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 16, 2021

Hi @Khan , 

Welcome to the community. 

Could you share, please, the link to stackoverflow thread ? 

 

At the moment, you need to evaluate a cache mechanism. 

1. First step is keeping data for the time period. 

2. Next step is pooler. 

3. After you can start to tune, data storage mechanism LRU, LFU, LFRU, etc. 

4. How exactly your queries are doing, is it possible to make in async mode? expiration mode?

5. And last question, do you really need to have that? How do you want to measure? 

Cheers,

Gonchik

Like Khan likes this
Khan January 16, 2021

Hi @Gonchik Tsymzhitov ,

Thanks and here is the link to stackoverflow thread
Although, no replies yet :(

Below are answers to some of your questions:

- when async mode is enabled, then confluence server deletes all contents upon saving the page.(considering it cross-site-scripting attack, probably). Therefore, I'm working with backups all the time. Expiration time equals page load.

- all requests are based upon a date interval, which is set before the page is reloaded. (you definitely have to be logged in to Jira, before reloading the page.)

- the confluence page is used by the management to check how well a product team is performing ie. % of overall requirement coverage, number of manual or automated tests, api coverage, defects (sprint/prod) etc.

- sorry, I don't know data storage mechanism LRU, LFU, LFRU

TAGS
AUG Leaders

Atlassian Community Events