REST API
Additionally to copying templates by invoking PTC via Confluences web UI, it is also possible to utilize PTC's own REST API for this purpose.
Note: This API might be subject to change. Use with caution and conduct necessary tests of your systems before updating to a newer version of Page Tree Creator!
Template copying procedure
To start the copying process, execute a POST request to PTC's /instantiation web resource. Attach the necessary JSON document as the body to the request, as further specified below. Keep in mind that not all fields in the PlaceholderDto are necessarily required, only the ones needed for the specific placeholder type.
If the request was processed successfully, PTC will return a response containing a taskId which is necessary to monitor the progress of the page copying process via Confluences Long Running Task API. Once the process has completed, execute a GET request to PTC's /completed web resource, including the taskId in the request. PTC will respond with the outcome of the copying process, and if successful, include the URL to the newly created page in the response.
This API was published on special request from some of our customers and the specification might be incomplete. If you need further assistance, feel free to get in touch with our support via our service desk or via E-Mail at apps@eps-support.ch
For simple tests, you can use Postman to test your CRUD operations.
Page Tree Creator v8
[ Base URL: /rest/treecreator/1.0 ]
Placeholder search
GET instantiations/placeholders/{sourcePageId}
The procedure (long running task, task handle) for querying this resource is the same as for the instantiation resource.
The creationType query parameter accepts the same values as in the instantiation resource.
Parameters
Name | Description |
sourcePageId *required (path) | Id of the Page, that you would like to copy. |
targetSpaceKey *required (query) | Key of the Space, on which your target page is located. |
targetPageId *required (query) | Id of your target page (this would be the new root page) |
currentPageId (query) | Current page id (For example where the button is located) |
unselectedPages (query) | Id’(s) of the page(s) which should not be copied to the target page tree. Note: page ids as an array (comma separated) |
creationType *required (query) | on of the following types:
|
Response
Code | Description |
---|---|
200 | OK
CODE
|
Template Instantiation
POST /instantiations
Parameters
Name | Description |
Body *required (body) | body as See Body Example and Model |
Response
Code | Description |
---|---|
200 | OK
CODE
|
Body Example
{
"sourcePageId": 0,
"type": "page",
"creationType": "CREATE_PAGE_TREE",
"jumpIntoEdit": true,
"labels": "string",
"pagesToWatch": "MAIN",
"resolvePageTitles": true,
"tagReplacements": [
{
"tag": "__placeholder__",
"placeholderType": "STANDARD",
"replacement": "string",
"replacements": [
"string"
],
"errorMessages": [
"string"
],
"id": 0,
"required": true,
"linkText": "string",
"userSeparator": "string",
"dropdownSeparator": "string",
"countupLocation": "string",
"counterPrefix": "string",
"counterPostfix": "string",
"counterNumberOfDigits": 0,
"currentCount": 0
}
],
"targetPageId": 0,
"targetSpaceKey": "string",
"unselectedPages": [
0
]
}
Response
Code | Description |
---|---|
200 | OK
CODE
|
YAML
Completed
GET /completed/{taskId}
Use the Response from the Placeholder Search and Template Instantiation (task-id
) for:
Placeholder Search: To get all the placeholders found by the placeholder search (
/instantiations/placeholders/{sourcePageId}
)Template Instantiation: To track the process of the Page Creation (
/instantiations
)
Parameters
Name | Description |
taskId *required string (path) | taskId (response from |
Response
Code | Description |
---|---|
200 | OK Placeholder Search TaskId:
Template Instantiation TaskId:
|
YAML