projectdoc Toolbox

Adds, removes, and applies changes to properties and sections of a projectdoc document.

Parent
Type
Extension
Since
1.1
Path
rest/projectdoc/1/document

Adds, removes, and applies changes to properties and sections of a  projectdoc document.

Use

  • from [space keys]
  • where [constraints]

to select on projectdoc documents. All documents in the result set will have applied the changes specified in the patch document.


Backup your Data!

 

There is no undo!

It is strongly recommended to run commands only on backed-up instances!

Make a backup of your data before starting to work with this API! Consider to run your experiments on a copy of the production data!

If your environment does not support the HTTP PATCH method try to use the patch resource at projectdoc/1/patch/document as a workaround.

The patch document has the following form (JSON):

  {
    "property": [
      {
        "name": "New Property",
        "value": "My Value",
        "controls": "",
        "position": "after",
        "ref": "Name"
      }
    ],
    "section": [
      {
        "title": "My Section",
        "content": "<p>Some text</p>",
        "position": "before",
        "ref": "References"
      }
    ]
  }

The name, value, and controls specify the values for the property to apply. The title and content specify the information for the section.

The position and ref specify the position where to add the property or section. The position may be one of the following keywords, while ref (that is: reference) specifies the name of a property or title of a section relative to which the position is evaluated.

PositionTargetSupports refDescription
beforeProperty (tick) Add the property before the property specified by ref. If the referenced property is not found, a 404 will be returned for that document.
beforeSection (tick) Add the section before the section specified by ref. If the referenced section is not found, a 404 will be returned for that document.
afterProperty (tick) Add the property after the property specified by ref. If the referenced property is not found, a 404 will be returned for that document.
afterSection (tick) Add the section after the section specified by ref. If the referenced section is not found, a 404 will be returned for that document.
firstProperty (error) Add the property in front of all properties.
firstSection (error) Add the section in front of all sections.
lastProperty (error) Add the property after all properties.
lastSection (error) Add the section after all sections.
deleteProperty (error) Deletes the specified property.
deleteSection (error) Deletes the specified section
replaceProperty (question) Replaces the specified property with this information. The ref references the property to be replaced (defaults to name).
mergeProperty (question)

Merges the specified property with this information. If no information is provided for value or controls, the existing information is not changed. The ref references the property to have the new information merged into (defaults to name).

Since version 4.10 this position allows to rename a property if value and controls are empty.

merge-valuesProperty (question) Like merge but also merges properties provided into list values. Available since version 3.1.
delete-valuesProperty (error) Like merge-values but removes the elements from the property list value. Available since version 3.1.
replace-valuesProperty(question)Like merge-values but clears the values before inserting the new. Available since version 6.0.
replace-or-addProperty (question) Replaces the property with the given name if it exist, otherwise adds a new property at the end. The ref references the property to be replaced (defaults to name).
replaceSection (question) Replaces the specified section. The ref references the section to be replaced (defaults to title).

If a query is executed, the from parameter is required.

Parameters

The parameters allow to specify parameters to run patches on selected documents.

Use from and where to select the documents to patch. It is recommended to use the id-list parameter to explicitly list the documents to change by their ids.

from

The comma-separate space keys to select documents from.

Mandatory if not id-list  is specified. Use @all to fetch from all spaces, but handle with care since it may return a very large response.

where

The constraint to filter documents from selected spaces.

id-list

A list of document (aka page) identifiers to change.

If empty a query using from and where is executed, otherwise the referenced documents are processed.

new-version

 Flag to control whether a new version should be created. If set to false, the document is saved without creating a new version. Defaults to true to create a new version.

The parameter is available since version 1.2.

comment

 The optional comment for the version. If no new version is created, the current comment is overridden.

The parameter is available since version 1.2.

Examples

Examples on using the patch service.

 

It is typically a good idea to fetch the the list of matching document IDs first. On this result set, use a patch call.

Deleting Properties
Delete properties for a set of documents specified by their IDs.
Adding Properties
Add properties for a set of documents specified by their IDs.

Resources

Related information on using REST APIs (with cURL) to integrate with remote information systems.

REST Login to Confluence with cURL
To access Confluence via its REST API with cURL you typically need to authenticate. Learn how to login with cURL and avoid some common security pitfalls.
Accessing projectdoc Properties with cURL
Learn how to access projectdoc properties via REST API with cURL.
projectdoc Bulk Changes to Documents
The Web API Extension for the projectdoc Toolbox can be employed to make bulk changes to documents. Since there is no safety net, these actions need to be take with care. This tip introduces a way to conduct this task.
Confluence as the Information Hub
Tools from the projectdoc Toolbox to import from and export to other information systems.
Import Resource
Provides services to import information from Maven artifacts into Confluence.