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.
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.
Position | Target | Supports ref | Description |
---|---|---|---|
before | Property | | Add the property before the property specified by ref . If the referenced property is not found, a 404 will be returned for that document. |
before | Section | | Add the section before the section specified by ref . If the referenced section is not found, a 404 will be returned for that document. |
after | Property | | Add the property after the property specified by ref . If the referenced property is not found, a 404 will be returned for that document. |
after | Section | | Add the section after the section specified by ref . If the referenced section is not found, a 404 will be returned for that document. |
first | Property | | Add the property in front of all properties. |
first | Section | | Add the section in front of all sections. |
last | Property | | Add the property after all properties. |
last | Section | | Add the section after all sections. |
delete | Property | | Deletes the specified property. |
delete | Section | | Deletes the specified section |
replace | Property | | Replaces the specified property with this information. The ref references the property to be replaced (defaults to name ). |
merge | Property | | Merges the specified property with this information. If no information is provided for value or controls, the existing information is not changed. The Since version 4.10 this position allows to rename a property if value and controls are empty. |
merge-values | Property | | Like merge but also merges properties provided into list values. Available since version 3.1. |
delete-values | Property | | Like merge-values but removes the elements from the property list value. Available since version 3.1. |
replace-values | Property | Like merge-values but clears the values before inserting the new. Available since version 6.0. | |
replace-or-add | Property | | 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 ). |
replace | Section | | 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.
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.
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.