Jira Courses, Training and Consulting: Sparxsys Trainings
Thanks for coming here, I hope you are enjoying learning here, I have also written some books in case you want to learn a bit more :)
If you need my help with Drupal, Linux, Jira, Scripting, Automation or want to contact me then raise a ticket for me please :) and I will get back to you, promise. At Sparxsys we provide Atlassian consultancy services, reach out to me at ravi at sparxsys dot com

Jira REST API - Update Announcement Banner

Today I tried the new REST end point to get and update the announcement banner. I think it could be really useful to let your user know about important updates like outages.

#JiraRESTAPI #AnnouncementBanner

Jira shell scripts

Today, let us learn a new end point in Jira REST API. Now, I keep an eye on the Jira REST API documentation where you can find the information about all the endpoints. Each and everything that you can do with Jira cloud using REST API is listed on this page, on this particular page you have various details like the end points, body that you need to pass in your REST call especially in cases where you need update or create something in Jira like an issue.

Now, today I thought I'll probably take a look at this end point to manage the announcement banner in Jira. It is the very first link or first endpoint on the Jira REST API documentation page because of course it is alphabetically listed here. Now, this is something new because I noticed it recently but never really used it and today I thought I'll probably just play with it and of course I want to share it with you as well. Now this is definitely interesting because what I can see here is that you can of course get the current announcement banner and you can also update it. Wonderful.

So to get the announcement banner you need to simply use this endpoint called /rest/api/3/announcementBanner and you can of course do it from the browser if you are logged in to your Jira instance. So this is my current announcement banners message which is of course something that you can also see here which is great. The thing about announcement banner is if you're on cloud it is slightly different as compared the server or data centre where we always had this option to use announcement banners but, we could also insert HTML and JavaScript which of course you can't really do on Jira cloud. Let me show you the current announcement banner's configuration so you can go to the system and then you can go to your announcement banner and here you can simply update your announcement banner.

Now, when you configure announcement banner you have the option to of course enable it or disable it and at the same time this feature to let users can dismiss the banner is something quite useful where you don't really want this banner to be displayed all the time to the user, maybe you just want to display it once and then the user can if they don't really want the banner just cancel it. For example I'll probably keep this turned on and of course you have the visibility level which is public or private. Now the thing about the announcement banner is that you can also update it on using an endpoint.

Now, this endpoint which is the same endpoint is something that you can use to change it or maybe replace it with something else and and I think there are a lot of use cases where you may want to let your Jira users know that something is happening or something has happened like an outage in another tool and maybe you want to do it programmatically without someone going to Jira and do it manually. Another good thing about this Jira REST API page is that you have various examples. For example, if you're using forge which I can simply copy and paste the code and I can of course use this endpoint. My favourite is of course curl which I will use for this particular example, I will use of course my shell script which is nothing but a curl command. I am simply passing in the body here which is something that you can also see in this body which is of course the data that you're passing where you have the option to set the visibility public or private and to enable it set to true or false . Also whether users can dismiss the banne by setting true or false again and finally the actual message.

So the actual message here is my support portal's url, maybe i'll just change it to something else and to run this of course I will run a script which is nothing but a call command I prefer of course shell scripts because you can organise your arguments that you're passing and in my shell scripts I have announcement banner, the authentication information is usually coming from my environment variable right which of course you can set or you can also pass in the script while running it. Hard coding token is not safe in case you are sharing your script.

I've already made this script executable so just need to run the script and you can see the response which is 204 which looks good and if you go back to Jira instance hopefully this sparxsys.com will be changed to ravisagar.in and I'm sure you can find a lot of other use cases but this ability to update this using REST API is guess quite useful.



* indicates required

Please confirm that you would like to from Sparxsys:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices.

Want to contact me?