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 (DEPRECATED)
GET instantiations/placeholders/{sourcePageId}
Placeholder search (new since PTC v. 8.7.0)
POST /placeholderSearch/{sourcePageId}
Parameters
|
Name |
Description |
|
Body *required (body) |
body as See Placeholder Search Body Example and Model
|
Response
|
Code |
Description |
|---|---|
|
200 |
OK
|
Placeholder Search Body Example
{
"targetSpaceKey": "string",
"targetPageId": 0,
"currentPageId": 0,
"unselectedPages": [
1001,
1002
],
"labels": [
"label1",
"label2"
],
"creationType": "CREATE_PAGE_TREE"
}
Template Instantiation
POST /instantiations
Parameters
|
Name |
Description |
|
Body *required (body) |
body as See Instantiation Body Example and Model
|
Response
|
Code |
Description |
|---|---|
|
200 |
OK
|
Page Instantiation Body Example
{
"sourcePageId": 0,
"type": "page",
"creationType": "CREATE_PAGE_TREE",
"jumpIntoEdit": true,
"pagesToWatch": "MAIN",
"resolvePageTitles": true,
"labels": [
"string"
],
"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
],
"copyOptions": {
"copyAttachments": true,
"copyLabels": true,
"copyRestrictions": true
}
}
Response
|
Code |
Description |
|---|---|
|
200 |
OK
|
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/placeholderSearch/{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
Models