### Define 'Let's Get Started' Page Strings in Properties File Source: https://developer.atlassian.com/server/confluence/write-an-advanced-blueprint-plugin Add these key-value pairs to your properties file to internationalize the title and content of the 'Let's Get Started' page. ```properties my.blueprint.letsgetstarted.title=About this blueprint my.blueprint.letsgetstarted.content=You can choose between two reports. One uses a table; one does not. ``` -------------------------------- ### Confluence Startup Output Source: https://developer.atlassian.com/server/confluence/enabling-tinymce-plugins This is an example of the expected output when the 'atlas-run' command successfully starts a Confluence instance with your plugin installed. Note the URL and shutdown instructions. ```bash [INFO] [talledLocalContainer] INFO: Starting Coyote HTTP/1.1 on http-1990 [INFO] [talledLocalContainer] Tomcat 8.x started on port [1990] [INFO] confluence started successfully in 132s at http://localhost:1990/confluence [INFO] Type Ctrl-D to shutdown gracefully [INFO] Type Ctrl-C to exit ``` -------------------------------- ### Example API Call for Pagination Source: https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api This example demonstrates how to make a GET request to retrieve a paginated list of content pages. The 'limit' parameter specifies the maximum number of items per page, and 'start' indicates the offset for the current page. ```bash curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/space/ds/content/page?limit=5&start=10" | python -mjson.tool ``` -------------------------------- ### Define 'Let's Get Started' Page Template in Soy Source: https://developer.atlassian.com/server/confluence/write-an-advanced-blueprint-plugin Add this Soy template to define the content for your blueprint's 'Let's Get Started' page. It includes a title and descriptive text. ```soy {namespace MyPlugin.Blueprints.Simple} /** * Let's-get-started page for the Create dialog */ {template .letsGetStarted}

{getText('my.blueprint.letsgetstarted.title')}

{getText('my.blueprint.letsgetstarted.content')}

{/template} ``` -------------------------------- ### Confluence Started Successfully Message Source: https://developer.atlassian.com/server/confluence/adding-new-confluence-to-hipchat-notifications Example output indicating a successful Confluence startup, including the URL and shutdown instructions. ```bash [INFO] Confluence started successfully in 71s at http://localhost:1990/confluence [INFO] Type CTRL-D to shutdown gracefully [INFO] Type CTRL-C to exit ``` -------------------------------- ### Example Request URI for Get Global Permissions Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-global-permissions An example of the URI to use when requesting global permissions. ```HTTP https://example.com/confluence/rest/api/permissions ``` -------------------------------- ### Example Request using cURL Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-space Demonstrates how to make a GET request to retrieve trash contents of a space using cURL. ```curl curl --request GET \ --url 'http://{baseurl}/confluence/rest/api/space/{spaceKey}/trash' \ --header 'Accept: application/json' ``` -------------------------------- ### Browse Content with Pagination Source: https://developer.atlassian.com/server/confluence/rest/v10214 This example demonstrates how to fetch content with pagination. You can control the number of results per page using the 'limit' parameter and specify the starting point with the 'start' parameter. The response includes '_links' to navigate to the next or previous pages. ```APIDOC ## Browse content with pagination To browse content with next or previous pagination use `_links.next` or `_links.prev`. ### Method GET ### Endpoint /rest/api/content ### Query Parameters - **limit** (integer) - Optional - The maximum number of content items to return per page. - **start** (integer) - Optional - The starting index of the content to return. ### Request Example ```bash curl -u admin:admin http://localhost:8080/confluence/rest/api/content?limit=2&start=2 ``` ### Response Example ```json { "results": [ { "id": "393239", "type": "page", "status": "current", "title": "Page 3", "extensions": { "position": 2 }, "_links": { "webui": "/display/FS/Page+3", "edit": "/pages/resumedraft.action?draftId=393239&draftShareId=9041c7ee-064e-448e-a354-d2117661ec0c", "tinyui": "/x/FwAG", "self": "http://localhost:8080/confluence/rest/api/content/393239" }, "_expandable": { "container": "/rest/api/space/FS", "metadata": "", "operations": "", "children": "/rest/api/content/393239/child", "restrictions": "/rest/api/content/393239/restriction/byOperation", "history": "/rest/api/content/393239/history", "ancestors": "", "body": "", "version": "", "descendants": "/rest/api/content/393239/descendant", "space": "/rest/api/space/FS" } }, { "id": "393244", "type": "page", "status": "current", "title": "Second space Home", "extensions": { "position": "none" }, "_links": { "webui": "/display/SS/Second+space+Home", "edit": "/pages/resumedraft.action?draftId=393244", "tinyui": "/x/HAAG", "self": "http://localhost:8080/confluence/rest/api/content/393244" }, "_expandable": { "container": "/rest/api/space/SS", "metadata": "", "operations": "", "children": "/rest/api/content/393244/child", "restrictions": "/rest/api/content/393244/restriction/byOperation", "history": "/rest/api/content/393244/history", "ancestors": "", "body": "", "version": "", "descendants": "/rest/api/content/393244/descendant", "space": "/rest/api/space/SS" } } ], "start": 2, "limit": 2, "size": 2, "_links": { "self": "http://localhost:8080/confluence/rest/api/content", "next": "/rest/api/content?limit=2&start=4", "prev": "/rest/api/content?limit=2&start=0", "base": "http://localhost:8080/confluence", "context": "/confluence" } } ``` ``` -------------------------------- ### Full Properties File with All Blueprint Strings Source: https://developer.atlassian.com/server/confluence/write-an-advanced-blueprint-plugin This properties file contains all the necessary strings for your blueprint, including those for the 'Let's Get Started' page, form labels, and wizard descriptions. ```properties my.blueprint.title=First Template my.blueprint.title2=Second Template my.create-link.title=My Sample Template my.create-link.description=Create a new SimpleBB template my.blueprint.form.label.title.vName=Name my.blueprint.form.label.templatekey=Choose a template my.blueprint.wizard.page1.title=Simplebp WIZARD my.blueprint.wizard.page1.desc.header=About this blueprint my.blueprint.wizard.page1.desc.content=Use this blueprint to create a table with your name and email. my.blueprint.letsgetstarted.title=About this blueprint my.blueprint.letsgetstarted.content=You can choose between two reports. One uses a table; one does not. ``` -------------------------------- ### Configure Blueprint Module with 'How-to-use-template' Source: https://developer.atlassian.com/server/confluence/write-an-advanced-blueprint-plugin In `atlassian-plugin.xml`, add the `how-to-use-template` attribute to your blueprint module, referencing the Soy template for the 'Let's Get Started' page. ```xml ``` -------------------------------- ### Example API Response with Pagination Source: https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api This example demonstrates an API response that includes pagination information. The `limit` parameter controls the number of items per page, and the `start` parameter indicates the offset for the current page. The `next` link shows how to retrieve the subsequent page of results. ```APIDOC ## GET /rest/api/space/{spaceKey}/content/page ### Description Retrieves a list of content pages within a specified space, with support for pagination. ### Method GET ### Endpoint /rest/api/space/{spaceKey}/content/page ### Query Parameters - **limit** (integer) - Optional - The maximum number of items to return per page. Defaults to 25. - **start** (integer) - Optional - The starting index of the results to return. Defaults to 0. ### Response #### Success Response (200) - **limit** (integer) - The number of items returned in this response. - **start** (integer) - The starting index of the items returned in this response. - **size** (integer) - The total number of items returned in this response. - **_links** (object) - Contains links for navigation: - **self** (string) - URL for the current request. - **next** (string) - URL for the next page of results, if available. - **previous** (string) - URL for the previous page of results, if available. - **results** (array) - An array of content items. ### Response Example ```json { "_links": { "base": "http://localhost:8080/confluence", "context": "", "next": "/rest/api/space/ds/content/page?limit=5&start=5", "self": "http://localhost:8080/confluence/rest/api/space/ds/content/page" }, "limit": 5, "results": [ { "_expandable": { "ancestors": "", "body": "", "children": "/rest/api/content/98308/child", "container": "", "descendants": "/rest/api/content/98308/descendant", "history": "/rest/api/content/98308/history", "metadata": "", "space": "/rest/api/space/ds", "version": "" }, "_links": { "self": "http://localhost:8080/confluence/rest/api/content/98308", "tinyui": "/x/BIAB", "webui": "/pages/viewpage.action?pageId=98308" }, "id": "98308", "status": "current", "title": "What is Confluence? (step 1 of 9)", "type": "page" } ], "size": 5, "start": 0 } ``` ``` -------------------------------- ### Get Content with Expanded Body and Version Source: https://developer.atlassian.com/server/confluence/rest/v10214 This example demonstrates how to retrieve content in storage format, including its body and version information, which is necessary for subsequent updates. ```APIDOC ## GET Content with Expanded Body and Version ### Description Retrieves content, expanding the body to storage format and including version information. This is a prerequisite for updating content. ### Method GET ### Endpoint /rest/api/content?type=page&spaceKey=TEST&expand=body.storage,version ### Parameters #### Query Parameters - **type** (string) - Required - The type of content to retrieve (e.g., 'page'). - **spaceKey** (string) - Required - The key of the space to search within. - **expand** (string) - Optional - Specifies which additional fields to expand. 'body.storage' and 'version' are used here. ### Response #### Success Response (200) Returns a JSON object containing content details, including the body in storage format and version information. #### Response Example ```json { "_links": { "base": "http://localhost:8080/confluence", "context": "", "self": "http://localhost:8080/confluence/rest/api/content" }, "limit": 20, "results": [ { "_expandable": { "ancestors": "", "children": "/rest/api/content/589828/child", "container": "", "descendants": "/rest/api/content/589828/descendant", "history": "/rest/api/content/589828/history", "metadata": "", "space": "/rest/api/space/TEST" }, "_links": { "self": "http://localhost:8080/confluence/rest/api/content/589828", "tinyui": "/x/BAAJ", "webui": "/display/TEST/Test+Space+Home" }, "body": { "_expandable": { "anonymous_export_view": "", "editor": "", "export_view": "", "view": "" }, "storage": { "_expandable": { "content": "/rest/api/content/589828" }, "representation": "storage", "value": "..." } }, "id": "589828", "status": "current", "title": "Test Space Home", "type": "page", "version": { "by": { "_links": { "self": "http://localhost:8080/confluence/rest/api/user?accountId=..." }, "displayName": "admin", "emailAddress": "admin@example.com", "type": "known" }, "when": "2023-10-27T10:00:00.000+0000", "friendlyDescription": "", "message": "", "number": 1 } } ] } ``` ``` -------------------------------- ### Web Panel Module Configuration Example Source: https://developer.atlassian.com/server/confluence/web-panel-plugin-module Example of a basic web-panel module configuration with a key. ```xml ... ``` -------------------------------- ### Full atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/confluence/write-an-advanced-blueprint-plugin This is a comprehensive example of the `atlassian-plugin.xml` file, including the blueprint module with the 'how-to-use-template' attribute and other essential plugin configurations. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png com.atlassian.auiplugin:ajs com.atlassian.confluence.plugins.confluence-create-content-plugin:resources com.atlassian.confluence.plugins.soy:soy-core-functions ``` -------------------------------- ### Get Space Content Pages with Pagination Source: https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api This example demonstrates how to retrieve a paginated list of pages within a space. The `limit` parameter controls the number of results per page, and `start` specifies the offset. The absence of a `next` link in the response indicates the end of the results. ```APIDOC ## GET /rest/api/space/{spaceKey}/content/page ### Description Retrieves a paginated list of pages within a specified space. ### Method GET ### Endpoint /rest/api/space/{spaceKey}/content/page ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of results to return per page. - **start** (integer) - Optional - The starting offset of the results. ### Request Example ```bash curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/space/ds/content/page?limit=5&start=10" ``` ### Response #### Success Response (200) - **_links** (object) - Contains links to related resources, including 'next' if more pages are available. - **limit** (integer) - The limit applied to the results. - **results** (array) - An array of page objects. - **size** (integer) - The number of results returned in this response. - **start** (integer) - The starting offset for this response. #### Response Example ```json { "_links": { "base": "http://localhost:8080/confluence", "context": "", "prev": "/rest/api/space/ds/content/page?limit=5&start=5", "self": "http://localhost:8080/confluence/rest/api/space/ds/content/page" }, "limit": 5, "results": [ { "_expandable": { "ancestors": "", "body": "", "children": "/rest/api/content/589845/child", "container": "", "descendants": "/rest/api/content/589845/descendant", "history": "/rest/api/content/589845/history", "metadata": "", "space": "/rest/api/space/ds", "version": "" }, "_links": { "self": "http://localhost:8080/confluence/rest/api/content/589845", "tinyui": "/x/FQAJ", "webui": "/display/ds/The+eleventh+page" }, "id": "589845", "status": "current", "title": "The eleventh page", "type": "page" } ], "size": 1, "start": 10 } ``` ``` -------------------------------- ### Complete atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/confluence/extending-autoconvert A full example of the `atlassian-plugin.xml` file including the web-resource module for the autoconvert functionality. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png Changes link text for URLs pasted from https://developer.atlassian.com. com.atlassian.auiplugin:ajs com.atlassian.confluence.plugins.confluence-paste:autoconvert-core editor ``` -------------------------------- ### Full atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/confluence/write-a-simple-confluence-space-blueprint This is a comprehensive example of an atlassian-plugin.xml file, including plugin information, resources, web resources, content templates, and space blueprint definitions. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png com.atlassian.confluence.plugins.soy:soy-core-functions com.atlassian.confluence.plugins.confluence-create-content-plugin:space-blueprints create-space       ``` -------------------------------- ### Complete Plugin Descriptor Example Source: https://developer.atlassian.com/server/confluence/enabling-tinymce-plugins A full example of an atlassian-plugin.xml file, including plugin information, i18n resources, and web resources with AMD module transformations. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png com.atlassian.auiplugin:ajs editor ``` -------------------------------- ### Get Active Users Request Example Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-admin-users This example demonstrates how to make a GET request to retrieve a paginated list of active users. Ensure to replace {baseurl} with your Confluence instance URL. This endpoint is not accessible by Forge and OAuth2 apps. ```curl curl --request GET \ --url 'http://{baseurl}/confluence/rest/api/admin/users/list/active' \ --header 'Accept: application/json' ``` -------------------------------- ### Example Macro Implementation Source: https://developer.atlassian.com/server/confluence/how-do-i-get-my-macro-output-exported-to-html-and-pdf An example demonstrating how to use ExportDownloadResourceManager within a Confluence macro to write output for exports. ```APIDOC ## ExampleMacro ### Description This example macro shows how to obtain a `DownloadResourceWriter` to store macro-generated output, such as images, for export. ### Class Structure ```java public class ExampleMacro extends BaseMacro { private ExportDownloadResourceManager exportDownloadResourceManager; public void setExportDownloadResourceManager(ExportDownloadResourceManager exportDownloadResourceManager) { this.exportDownloadResourceManager = exportDownloadResourceManager; } public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException { // ... (parse parameters and generate output/image) ... // Get the current user User user = AuthenticatedUserThreadLocal.getUser(); String userName = user == null ? "" : user.getName(); // Get the resource writer DownloadResourceWriter writer = exportDownloadResourceManager.getResourceWriter(userName, "example", "png"); OutputStream outputStream = writer.getStreamForWriting(); try { // ... (write to the output stream) ... } finally { // Close the output stream if(outputStream != null) outputStream.close(); } // Return the resource path for the generated output return ""; } } ``` ``` -------------------------------- ### Get Spaces by Key - Example Request URI Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-space This is an example of a request URI to retrieve spaces by their keys. Multiple space keys can be provided. ```http http://example.com/confluence/rest/api/space?spaceKey=TST&spaceKey=ds ``` -------------------------------- ### Complete ExampleMacroTest Class Source: https://developer.atlassian.com/server/confluence/unit-testing-plugins This is the complete unit test class for `ExampleMacro`, including setup, teardown, and two test methods: one for recent pages and one for the current user. It utilizes Mockito for mocking dependencies. ```java package ut.com.atlassian.tutorial.confluence.plugin.unittesting; import com.atlassian.tutorial.confluence.plugin.unittesting.ExampleMacro; import com.atlassian.confluence.content.render.xhtml.ConversionContext; import com.atlassian.confluence.pages.Page; import com.atlassian.confluence.pages.PageManager; import com.atlassian.confluence.spaces.SpaceManager; import com.atlassian.confluence.user.AuthenticatedUserThreadLocal; import com.atlassian.user.impl.DefaultUser; import junit.framework.TestCase; import org.junit.Test; import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.util.Arrays; import java.util.HashMap; import org.mockito.runners.MockitoJUnitRunner; import static org.mockito.Mockito.when; /** * Testing {@link com.atlassian.tutorial.confluence.plugin.unittesting.ExampleMacro} */ @RunWith (MockitoJUnitRunner.class) public class ExampleMacroTest extends TestCase { @Mock private PageManager pageManager; @Mock private SpaceManager spaceManager; @Mock private ConversionContext conversionContext; private ExampleMacro exampleMacro; @Before public void setUp() throws Exception { super.setUp(); exampleMacro = new ExampleMacro(pageManager, spaceManager); } @Test public void testOutputIncludesRecentPages() throws Exception { // create test page Page page = new Page(); page.setTitle("Page title"); // set up stub method to return our test page when(pageManager.getRecentlyAddedPages(55, "DS")).thenReturn(Arrays.asList(page)); // verify that the output contains the page title String output = exampleMacro.execute(new HashMap(), "", conversionContext); assertTrue("Output should contain page title but was: " + output, output.contains(page.getTitle())); } @Test public void testOutputIncludesCurrentUser() throws Exception { // create test user DefaultUser user = new DefaultUser("test"); user.setFullName("Test User"); // set current user to test user AuthenticatedUserThreadLocal.setUser(user); try { // verify that the output contains the current user String output = exampleMacro.execute(new HashMap(), "", conversionContext); assertTrue("Output should contain current user but was: " + output, output.contains(user.getFullName())); } finally { // reset current user AuthenticatedUserThreadLocal.setUser(null); } } } ``` -------------------------------- ### Complete atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/confluence/adding-a-custom-action-to-confluence This is a comprehensive example of an atlassian-plugin.xml file, including plugin information, a web item, a Struts module, and resource definitions. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png Adds the "Add 'draft' label" action into the Tools menu. Defines what the "Add 'draft' label" action does. ${page.urlPath} com.atlassian.auiplugin:ajs AddDraftLabelAction ``` -------------------------------- ### Example response for getting restrictions by operation Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-content-restrictions This is an example JSON response when retrieving restrictions for a specific operation. It includes user and group restriction details. ```json { "operation": "read", "restrictions": { "user": { "results": [], "start": 0, "limit": 200, "size": 0 }, "group": { "results": [], "start": 0, "limit": 200, "size": 0 } }, "get_links": { "self": "https://instenv-320828-cq6e.instenv.internal.atlassian.com/rest/api/content/2326529/restriction/byOperation/read", "base": "https://instenv-320828-cq6e.instenv.internal.atlassian.com", "context": "" }, "get_expandable": { "content": "/rest/api/content/2326529" } } ``` -------------------------------- ### Space Permissions Response Example Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-space-permissions Example JSON response structure for the 'Get all space permissions' API call, illustrating the format of permission data returned. ```json [ { "operation": { "targetType": "space", "operationKey": "read" }, "subject": { "displayName": "", "type": "" }, "spaceKey": "", "spaceId": 2154 } ] ``` -------------------------------- ### Get Node Statuses in a Cluster (PHP) Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-cluster-information PHP code snippet for fetching cluster node statuses. This example uses cURL to send the GET request. ```php "http://{baseurl}/confluence/rest/api/cluster/nodes", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Accept: application/json" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error # " . $err; } else { echo $response; } ?> ``` -------------------------------- ### Full Servlet Context Listener Example Source: https://developer.atlassian.com/server/confluence/servlet-context-listener-module An example of an 'atlassian-plugin.xml' file that includes a single servlet context listener. This configuration defines the plugin's metadata and the listener's class and description. ```xml A basic Servlet context listener module test - says "Hello World!" 1.0 Initialises the Hello World plugin. ``` -------------------------------- ### Get Node Statuses in a Cluster (Java) Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-cluster-information Java code example for fetching cluster node statuses. This uses Apache HttpClient to make the GET request. ```java import java.io.IOException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class GetClusterNodes { public static void main(String[] args) throws IOException { CloseableHttpClient client = HttpClients.createDefault(); HttpGet request = new HttpGet('http://{baseurl}/confluence/rest/api/cluster/nodes'); request.addHeader('Accept', 'application/json'); try (CloseableHttpResponse response = client.execute(request)) { System.out.println(EntityUtils.toString(response.getEntity())); } } } ``` -------------------------------- ### Full atlassian-plugin.xml Configuration Source: https://developer.atlassian.com/server/confluence/write-an-intermediate-blueprint-plugin This is a complete example of an atlassian-plugin.xml file, including the content-template module with the custom context provider configuration. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png com.atlassian.auiplugin:ajs simplebp ``` -------------------------------- ### Space Properties Response Example Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-space-property Example JSON response for a GET request to retrieve space properties. It includes details about the properties, their versions, and associated space information. ```JSON { "results": [ { "key": "", "value": { "value": "" }, "version": { "by": {}, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": {}, "contentRef": {} }, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": {}, "description": {}, "homepage": {}, "links": {}, "type": "global", "creator": {}, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": {}, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": {}, "permissions": {} }, "spaceRef": { "idProperties": {}, "expanded": true }, "_links": { "base": "", "context": "", "self": "" }, "_expandable": { "attribute": "" } } ], "totalCount": 2154, "start": 25, "limit": 25, "size": 25, "_links": { "base": "http://localhost:8085/confluence", "context": "confluence", "self": "http://localhost:8085/rest/api/latest/..?limit=25&start=25", "next": "http://localhost:8085/rest/api/latest/..?limit=25&start=50", "prev": "http://localhost:8085/rest/api/latest/..?limit=25&start=0" } } ``` -------------------------------- ### Example Struts Action with GET/POST and no token Source: https://developer.atlassian.com/server/confluence/enable-xsrf-protection-for-your-app This Java example shows a Struts Action configured to accept GET and POST requests without requiring an XSRF token. ```java @XsrfProtectionExcluded @PermittedMethods({HttpMethod.GET, HttpMethod.POST}) public String execute() throws Exception { return SUCCESS; } ``` -------------------------------- ### Get Node Statuses in a Cluster (Node.js) Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-cluster-information Example of retrieving cluster node statuses using Node.js. This snippet demonstrates making a GET request to the cluster nodes endpoint. ```javascript const fetch = require('node-fetch'); const options = { method: 'GET', headers: { 'Accept': 'application/json' } }; fetch('http://{baseurl}/confluence/rest/api/cluster/nodes', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### FreeMarker Template Example Source: https://developer.atlassian.com/server/confluence/web-panel-renderer-plugin-module Create a FreeMarker template file (e.g., mytemplate.ftl) to define the content and structure of your web panel. This example demonstrates variable assignment, basic HTML, and list iteration. ```ftl <#assign color = "DarkRed">

This is a FreeMarker Web Panel!

<#assign people = [{"name":"Joe", "age":25}, {"name":"Fred", "age":18}]>
    <#list people as person>
  • ${person.name} is ${person.age}
``` -------------------------------- ### Example Response for Get Children of Content Source: https://developer.atlassian.com/server/confluence/rest/v10214/api-group-child-content This is an example JSON response when successfully retrieving children of a content item. It includes a list of results, total count, pagination details, and links. ```json { "results": [ { "id": "123456", "type": "page", "status": "current", "title": "My Page", "links": {}, "space": { "id": 123456, "key": "TEST", "name": "Test Space", "status": "current", "icon": {}, "description": {}, "homepage": {}, "links": {}, "type": "global", "creator": {}, "creationDate": "2024-01-01T00:00:00Z", "lastModifier": {}, "lastModificationDate": "2024-01-01T00:00:00Z", "metadata": { "labels": [ "label1", "label2" ] }, "retentionPolicy": {}, "permissions": {} }, "history": { "previousVersion": {}, "nextVersion": {}, "lastUpdated": {}, "latest": true, "createdBy": {}, "createdDate": "2020-01-01T00:00:00Z", "contributors": {}, "previousVersionRef": {}, "lastUpdatedRef": {}, "nextVersionRef": {}, "contentParentRef": {} }, "version": { "by": {}, "when": "2020-01-01T00:00:00Z", "message": "A message", "number": 1, "minorEdit": true, "hidden": true, "syncRev": "123456", "content": {}, "contentRef": {} }, "ancestors": [], "position": 1, "operations": [ { "operation": "read", "targetType": "page" } ], "children": {}, "descendants": {}, "body": {}, "metadata": { "key": "value" }, "extensions": { "key": "value" }, "restrictions": { "use": { "operation": "use", "restrictions": [] } }, "relevantViewRestrictions": { "idProperties": {}, "expanded": true }, "extractedTextLink": "/rest/api/content/98323/child/attachment/98329/extractedtext", "containerRef": { "idProperties": {}, "expanded": true }, "versionRef": { "idProperties": {}, "expanded": true }, "historyRef": { "idProperties": {}, "expanded": true }, "spaceRef": { "idProperties": {}, "expanded": true }, "_links": { "base": "", "context": "", "self": "" }, "_expandable": { "attribute": "" } } ], "totalCount": 2154, "start": 25, "limit": 25, "size": 25, "_links": { "base": "http://localhost:8085/confluence", "context": "confluence", "self": "http://localhost:8085/rest/api/latest/..?limit=25&start=25", "next": "http://localhost:8085/rest/api/latest/..?limit=25&start=50", "prev": "http://localhost:8085/rest/api/latest/..?limit=25&start=0" } } ```