Confluence - Create Page From Template
Overview
First, you will need your api token, confluence domain, and email.
You also need a URL of an already existing page within the space you want your new page to be uploaded – this is the Space URL.
Please note that the template you use must be a custom-made template in your agency. Here are two ways to view the list of such templates (for PMG): * * In Confluence* * You can go to the following page: * https://agencypmg.atlassian.net/wiki/templates?space=~7120206dae15ef5a8e433b85192cac9781d73a&template=2910748909&category=template.category.custom * Using the terminal: * Use the following terminal command to see the list of templates as the script sees them through the HTTP request. Please make sure to fill in your email and api token.
curl -s -G 'https://agencypmg.atlassian.net/wiki/rest/api/template/page' \
-u '<your-email>:<api_token>' \
-H 'Accept: application/json'
If you would like to obtain the Template ID of a template, you can use the following terminal command. Please make sure to fill in your email, api token, and the template name.
curl -s -G 'https://agencypmg.atlassian.net/wiki/rest/api/template/page' \
-u '<your-email>:<api_token>' \
-H 'Accept: application/json' \
| jq -r '.results[] | select(.name=="<Exact Template Name>") | .templateId'
Variables
| Name | Reference | Type | Required | Default | Options | Description |
|---|---|---|---|---|---|---|
| Access Token | CONFLUENCE_ACCESS_TOKEN | Password | ✅ | - | - | Get yours at: https://id.atlassian.com/manage-profile/security/api-tokens |
| CONFLUENCE_EMAIL | Alphanumeric | ✅ | - | - | Your email address that is associated with your Confluence account. | |
| Domain | CONFLUENCE_DOMAIN | Alphanumeric | ✅ | - | - | Your subdomain is the first part of the Confluence URL. For example, if your URL is https://agencypmg.atlassian.net/wiki/home, your subdomain is "agencypmg". |
| Page Title | PAGE_TITLE | Alphanumeric | ✅ | - | - | The title of the page to be created. Make sure it is unique within the space you are uploading to. |
| Space URL | SPACE_URL | Alphanumeric | ✅ | - | - | The Space URL is the url of another page in the space where you want your page to be uploaded. Please provide the whole URL of that page. |
| Template ID | TEMPLATE_ID | Alphanumeric | ➖ | - | - | The ID of the template you want to use as the basis for the created page. If you do not have this, provide the Template Name instead. Note: Only custom-made templates can be used here, please see the list of custom-templates on your agency's Confluence site. |
| Template Name | TEMPLATE_NAME | Alphanumeric | ➖ | - | - | The name of the template you want to use as the basis for the created page. Note: Only custom-made templates can be used here, please see the list of custom-templates on your agency's Confluence site. |
| Make it nested? | IS_NESTED | Boolean | ➖ | False | - | If True, Page ID will be extracted from the Space URL and the created page will be nested under that page. |
| Status | STATUS | Select | ➖ | normal | Normal: normal Draft: draft Live: live | Choose what type of page gets uploaded: 'draft', 'live', or 'normal' (default) |
YAML
Below is the YAML template
source:
template: Confluence - Create Page From Template
inputs:
CONFLUENCE_ACCESS_TOKEN:
CONFLUENCE_EMAIL:
CONFLUENCE_DOMAIN:
PAGE_TITLE:
SPACE_URL:
TEMPLATE_ID:
TEMPLATE_NAME:
IS_NESTED: false
STATUS: normal
type: TEMPLATE
guardrails:
retry_count: 1
retry_wait: 0h0m0s
runtime_cutoff: 1h0m0s
exclude_exit_code_ranges:
- 14
- 102
- 103
- 99
- 153
- 2