Forums

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

Method to schedule REST calls to an external API

Will Acheson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2018

Hi there,

 

This is my first post in the awesome Atlassian developer community, so bear with me.   My question is about whether or not it's possible to build a scheduling functionality into my Jira Cloud app.  My app syncs data from an external system onto Jira tickets, but currently that functionality is triggered externally (over an API which initiates the sync process). 

I want to instead handle scheduling of syncing data from within Jira itself.  I feel like this is a more seamless experience for users and has the additional benefit of not requiring a third external service to schedule REST calls that the user has to configure. 

 

I'd like to allow users to implement essentially CRON functionality with regards to the scheduled REST calls.  Then they'd be able to say "sync my data every day at 1:30 AM" etc etc.

I have been looking through the Jira Cloud documentation for such a functionality to no avail.  I have found some posts that imply an ability to schedule such events, scheduled filter subscription, for example.

A link to a post describing cron functionality is found here: https://confluence.atlassian.com/jirasoftwarecloud/constructing-cron-expressions-for-a-filter-subscription-764478409.html

Does anyone have experience with developing native scheduled REST calls as a part of a connect app for Jira?  Any tips or suggestions are greatly appreciated!  If Jira has the ability to send an email for a filter subscription based on CRON syntax, I would think such a CRON based method for my app would be possible as well. 

 

Thanks!

2 answers

0 votes
m@
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2018

Hello Will,

There is no functionality inside jira to create these scheduled sync hooks, so you will have to do this inside your connect add-on.

To make it seamless for your users, you can still provide a UI within Jira that will allow an admin to configure this synchronisation, but store it in your service.

I would follow this process:

1) Is your data project or global scoped?

If Project - Use a project settings location to create a page to configure your synchronisation schedule.

See: https://developer.atlassian.com/cloud/jira/platform/project-settings-ui-locations/

See: https://developer.atlassian.com/cloud/jira/platform/modules/page/

If Global - Same thing but use the administration ui locations.

See: https://developer.atlassian.com/cloud/jira/platform/administration-ui-locations/

2) The page module you define in step 1 will be provided by your connect add-on so it can store the schedule configuration locally to its service.  Jira will use an iframe to call to your service making it nice and simple to implement.

3) Use a library with in your service to interpret the scheduling information you've stored and perform the action for the tenant you need, ie push the data to Jira on the defined schedule.

Note: Make sure when you store the configuration, you are tenant aware and you don't get your schedules mixed up with other tenants.

Cheers

Matt

0 votes
Grégory Joseph
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2018

Hey Will - could you perhaps just build the scheduling on your end (and/or use something like cron-job.org maybe) and pull the data you need ?

There is no generic scheduling feature available for "public" consumption.

Suggest an answer

Log in or Sign up to answer