update_document
Update a Polarion document's metadata or body content, including title, status, type, custom fields, and workflow actions. Supports dry-run preview of changes.
Instructions
Update a Polarion document's metadata or body.
PATCHes only set attributes (omitted preserved); no follow-up GET — call
get_document for refreshed state. home_page_content_html is the
round-trip pair for get_document(include_homepage_content_html=True),
verbatim, no sanitization (NEVER pass untrusted input). Empty string
rejected (orphans headings); pass '<p></p>' for near-empty.
Body-write rules:
Headings auto-create: inline
<h1>..<h4>become heading work items withmodule/outline_numberset; bare<hN>Title</hN>is safe.Anchorless blocks break parts:
<h3>X</h3><p>Body</p>PATCHes 200 but the nextread_document_partsreturns HTTP 500. Every anchorless<p>/<ul>/<ol>/<table>/<div>/<blockquote>/<pre>needs a uniqueid=(tool raisesValueErrorbefore PATCH, on dry_run too). No auto-stamping here; for body text prefercreate_work_items+move_work_item_to_document.No macro references: a
polarion_wiki macro name=module-workitem<div>makes a part but leaves the work item'smoduleunset (half attached) — attach viamove_work_item_to_document.
Prefer workflow_action over raw status; it MUST pair with ≥1
attribute (empty PATCH 400s). Unknown status / type raise
ValueError; a custom_fields key absent from the document type's
sampled schema is rejected (a type with no populated customs blocks it).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Polarion project ID. | |
| space_id | Yes | Space ID (use '_default' for the default space). | |
| document_name | Yes | Document name within ``space_id``. | |
| title | No | ||
| status | No | New workflow status; prefer ``workflow_action`` for real transitions. | |
| type | No | New document type (e.g. 'req_specification'). | |
| home_page_content_html | No | New body as raw Polarion HTML (round-trip shape from get_document); '' is rejected. | |
| custom_fields | No | Partial custom-field update; rich-text values must be ``{'type':'text/html','value':...}``. | |
| workflow_action | No | Workflow action ID; must be paired with at least one attribute field. | |
| dry_run | No | When True, return the payload preview without writing; enum/custom-field guards still query Polarion, so the document must be readable and the validation endpoint reachable. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| updated | Yes | ||
| dry_run | Yes | ||
| payload_preview | Yes |