Breadcrumbs

Automation: Triggering Snapshots Automatically Via a Rest Call

Use Cases for Triggering Snapshots Automatically

It’s easy enough to go to a Confluence page and click “Take New Snapshot”, but that requires a manual, human, action.

Some scenarios are so predictable, that you can trigger a new Snapshot via auto-pilot, ensuring the Snapshot will have the correct data even when you are not around:

  1. Weekly status report is due every Friday? Set up a Jira automation scheduled rule, that triggers a new Snapshot every Friday morning.

  2. Using Jira Snapshots to share Jira Service Management status with user? Trigger a Snapshot each time that an applicable update happens in Jira.

  3. Using Jira Snapshot to generate test report? Trigger a newSnapshot directly from your CI/CD pipeline each time your automatic integration tests where executed.

Syntax

The following two parameters are required, and are unique for each Jira Snapshot macro:

  1. A MACRO-SPECIFIC-URL

  2. An API-KEY.

Retrieve these parameters from the macro configuration window, on the “Automation tab”

image-20231029-170648.png

https://radbeedocs.atlassian.net/wiki/s/-933780389/6452/92fa487229c18d1a743550e91f3e2134677685f6/_/images/icons/emoticons/information.png Copy the API Key- as there is only one opportunity to do that. If you loose the API Key you’ll need to regenerate a new one. The API Key itself is not saved by Jira Snapshot and hence cannot be retrieved again.

https://radbeedocs.atlassian.net/wiki/s/-933780389/6452/92fa487229c18d1a743550e91f3e2134677685f6/_/images/icons/emoticons/information.png Once enabled, SAVE the macro configuration to make this change effective.

Automation for Confluence 8.x

This is the REST CALL syntax to trigger a new Snapshot for an existing, configured, Jira Snapshot macro:

POST <MACRO-SPECIFIC-URL>

With this obligatory header:

  • jira-snapshots-api-key: <API-KEY>

Here is how it looks on CURL:


curl --location --request POST '<MACRO-SPECIFIC-URL>' \
--header 'jira-snapshots-api-key: <API-KEY>'

Jira Automation is the easiest way to trigger a snapshot automatically. Read how to set it up: Using Jira Automation to Trigger a Snapshot Automatically

Automation for Confluence 9.x and above

This is the REST CALL syntax to trigger a new Snapshot for an existing, configured, Jira Snapshot macro:

POST <MACRO-SPECIFIC-URL>

You’ll also need to use an Personal Authentication Token (PAT), and use it to authenticate the call (Bearer token)

Along with this obligatory header:

  • jira-snapshots-api-key: <API-KEY>

Here is how it looks on CURL:


curl --location --request POST '<MACRO-SPECIFIC-URL>' \
--header 'Authorization: Bearer <Personal-Authentication-Token>' \
--header 'jira-snapshots-api-key: <API-KEY>'

Jira Automation is the easiest way to trigger a snapshot automatically. Read how to set it up: Using Jira Automation to Trigger a Snapshot Automatically Revoking The Possibility to Trigger The Snapshot

To remove the possibility to trigger one of the Snapshot macros, you may:

  1. Regenerate the API Key. This will make all existing automations invalid (until they are updated with the new key).

  2. Disable the automation for this specific macro.

image-20231029-171618.png


A Confluence administrator can also revoke all enabled automations.