Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Make a table on a Confluence page via the Rest API for use with Jira Insights automation

Jira Service Management integrates seamlessly with Confluence where it can be used for both external KB and internal communication and documentation.

Jira Service Management includes Jira Insights, which is a native asset and CI management tool. 

One way that these three tools can work together is through a combination of JSM automation and the Confluence Rest API. JSM automation can look up objects in Jira Insights and using the API one can create a report on Asset changes, maintenance plans, and more.

Now, getting back to the title of my article, how do you actually create a table on a confluence page? Simply use the create content endpoint and the 'Send web request' action in JSM automation.

'Send web request' action allows you to use the Atlassian (or other) API, in the case of creating a Confluence page, you use the Content endpoint, and using custom data in the body request you can specify a title, choose a space, and even where in page hierarchy your new page should go and the body.

Here we come to creating a table in a page that is populated with data provided by your previous automation steps, in my example below I am listing the key, name, and the date of update of my assets. 

When creating content in Confluence you can use several representation types, and when you want to populate data it is best to use "representation":"wiki", this will allow you to use wiki markup to create a table as shown below.

{
"id": null,
"type": "page",
"title": "Changed Assets- Updated{{now.convertToTimeZone("Australia/Sydney").shortTime}}",
"space": { "key": "CIS" },
"ancestors": [{ "id": "xxxxxx"}],
"body":{"storage":{"value":
"||Key||Name||Updated||\n{{#lookupObjects}}|{{Tier}}|{{Name}}|{{Updated.format("dd/MM/yyyy")}}|\n{{/}}","representation":"wiki"}}
}

Screen Shot 2022-12-30 at 11.54.43 am.png

 

A quick note about Authorization headers,  you need an encoded string of your_email and your_user_api_token and this is what you will put next to Basic, to get your encoded string you do the following steps:

  1. Generate an API Token for your Atlassian Account: https://id.atlassian.com/manage/api-tokens
  2. Build a string of the form your_email@domain.com:your_user_api_token.
  3. You'll need to encode your authorization credentials to base64. There are online tools (i.e., https://www.base64encode.net/) that you can use to create your base64 encoded string. For example, your_email@domain.com:your_user_api_token base64 encoded is eW91cl9lbWFpbEBkb21haW4uY29tOnlvdXJfdXNlcl9hcGlfdG9rZW4=
  4. Supply an Authorization header with content Basic followed by the encoded string. Example: Authorization: Basic eW91cl9lbWFpbEBkb21haW4uY29tOnlvdXJfdXNlcl9hcGlfdG9rZW4=

 

1 comment

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 30, 2022

Great article @Elelta D !

Thank you for sharing this!

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events