Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Replacing the text on the page (replace all)

Available only for Confluence Administrators or Space Administrator

Method type: 

Status
colourYellow
titlePOST

URL: {CONFLUENCE_URL}/rest/extender/1.0/content/{PAGE_ID}/replaceAll

  • where {PAGE_ID} is the page

Request format: JSON

Example request:

Code Block
breakoutModewide
{
    "find": "Jira SD”,
    "replace": “Jira SM”,
    “ignoreCase”: true
}
Code Block
breakoutModewide
{
    "find": "Jira SD”,
    "replace": “Jira SM”
}
  • find - required - the text you want to replace

  • replace - required - the text you want to replace the search text with

  • ignoreCase - optional - whether the search text should be case-sensitive - true or false (default)

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "ignoreCase": true,
    "numberOfReplacements": 3,
    "message": "done"
}


Replacing the text on all pages in the space (replace all)

StatuscolourPurpletitleEXPERIMENTAL

Available only for Confluence Administrators or Space Administrator

Info

The replaceAll task runs a background process with an explicit logging (WARN) of which page is currently being processed.

This API can run only one instance of a background process, if any process is running in the background you'll be prompted the next time you try.

The API changes and indexes pages in packages of 50 pages so don't worry if progress stops for a long time on one package - the time of the whole process depends on the performance of the application.

Method type: 

Status
colourYellow
titlePOST

URL: {CONFLUENCE_URL}/rest/extender/1.0/space/{SPACE_KEY}/content/replaceAll

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request:

Code Block
breakoutModewide
{
    "find": "Jira SD”,
    "replace": “Jira SM”,
    “ignoreCase”: true
}
Code Block
breakoutModewide
{
    "find": "Jira SD”,
    "replace": “Jira SM”
}
  • find - required - the text you want to replace

  • replace - required - the text you want to replace the search text with

  • ignoreCase - optional - whether the search text should be case-sensitive - true or false (default)

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "message": "task 'replaceAll' for space 'DEMO' has been started in the background",
    "status": "done"
}
Code Block
breakoutModewide
languageactionscript3
{
    "message": "API 'replaceAll' for space 'DEMO' is in progress, wait for it to finish [50 of 166]",
    "status": "waiting"
}

Check process status

Method type -

Status
colourGreen
titleGET

URL: {CONFLUENCE_URL}/rest/extender/1.0/space/content/replaceAll/taskStatus

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "message": "no 'replaceAll' job for the space is running",
    "status": "done"
}
Code Block
breakoutModewide
languageactionscript3
{
    "message": "API 'replaceAll' for space 'DEMO' is in progress, wait for it to finish [100 of 166]",
    "status": "in progress"
}


Add text to the top of the page (prepend)

Available only for Confluence Administrators or Space Administrator

Method type: 

Status
colourYellow
titlePOST

URL: {CONFLUENCE_URL}/rest/extender/1.0/content/{PAGE_ID}/prepend

  • where {PAGE_ID} is the page

Request format: JSON

Example request:

Code Block
breakoutModewide
{
    "text": "<p>Update: Please check news</p>"

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "status": "done"
}


Add text to the end of the page (append)

Available only for Confluence Administrators or Space Administrator

Method type: 

Status
colourYellow
titlePOST

URL: {CONFLUENCE_URL}/rest/extender/1.0/content/{PAGE_ID}/append

  • where {PAGE_ID} is the page

Request format: JSON

Example request:

Code Block
breakoutModewide
{
    "text": "<p>This is the end of the page</p>"

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "status": "done"
}


Move/reorder page

Available to all users, but the API checks the appropriate permissions

Additional information:

  • if the source page contains child pages, its entire tree will be moved

  • you can move a page between spaces

Method type: 

Status
colourYellow
titlePOST

URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/content/movePage

or

  • {CONFLUENCE_URL}/rest/extender/1.0/content/reorderPage

Request format: JSON

Example request:

Code Block
breakoutModewide
{
	"sourcePageId": 123456,
	"targetPageId": 987654,
	"position": "below"
}
Code Block
breakoutModewide
{
	"sourcePageId": 123456,
	"targetPageId": 987654,
	"position": "above"
}
Code Block
breakoutModewide
{
	"sourcePageId": 123456,
	"targetPageId": 987654,
	"position": "append"
}

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "message": "The page 'Test page' already exists in space 'TEST'. You need to rename the page title before moving it."
}
Code Block
breakoutModewide
languageactionscript3
{
    "message": "Page 'Test page (Id: 851977)' moved.",
    "status": "done"
}
Code Block
breakoutModewide
languageactionscript3
{
    "message": "The source page cannot be the same as the target page."
}


Change the creator of all contents in the space created by user

Available only for Confluence Administrators

When sometimes a user leaves your company, you can change the content (pages / blogs) he has created to another user instead of an "unknown user"

Method type: 

Status
colourYellow
titlePUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/content/changeCreator/space/{SPACE_KEY}/user/{USER_NAME_OR_KEY}

  • where {SPACE_KEY} is the space key

  • where {USER_NAME_OR_KEY} is the user name or the user key

Request format: JSON

Example request:

Code Block
breakoutModewide
{
	"newCreatorName": "johnb"
}

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "total": 1,
    "contentsSkipped": [],
    "contentsChanged": [
        786506
    ],
    "message": "success"
}
Code Block
breakoutModewide
languageactionscript3
{
    "total": 5,
    "contentsSkipped": [],
    "contentsChanged": [
        786508,
        786509,
        786507,
        786514,
        786515
    ],
    "message": "success"
}


Change the creator of all content by id’s

Available only for Confluence Administrators

When sometimes a user leaves your company, you can change the content (pages / blogs) he has created to another user instead of an "unknown user"

Method type: 

Status
colourYellow
titlePUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/content/changeCreator/contentId

Request format: JSON

Example request:

Code Block
breakoutModewide
{
    "contentIds": [
        1111111, 2222222, 786506
    ],
	"newCreatorName": "johnb"
}

Response format: JSON

Example response:

Code Block
breakoutModewide
languageactionscript3
{
    "total": 1,
    "contentsSkipped": [
        1111111,
        2222222
    ],
    "contentsChanged": [
        786506
    ],
    "message": "success"
}