create_work_item_links
Create one or more outgoing links from a source work item, with atomic batch posting and validation of roles and targets to avoid ghost links.
Instructions
Create one or more outgoing links (1-50) from a single source work item.
All share the source and post atomically. Per spec target_project_id
defaults to source; revision pins (else HEAD); suspect marks
re-review. Guards both role (workitem-link-role) and target existence
before POST (on dry_run too) — unguarded they store as ghost/dangling links.
link_ids are 5-segment composites in input order (delete path ids). POST
is atomic: a 4xx (e.g. duplicate (role,target) → 409) rolls back the batch —
re-query before retry. Raises on an id-count mismatch.
Phantom-success footgun: when the source is in a document,
move_work_item_to_document already auto-created one link. A NEW same-role
link returns 201 but is NOT persisted. Verify forward (source) + back
(target); if missing, detach → create → re-attach.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Source work item's project ID. | |
| work_item_id | Yes | Source work item ID (the links' outgoing endpoint). | |
| links | Yes | One or more links to create under the source work item (1-50). | |
| dry_run | No | When True, return payload preview without calling Polarion. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| created | Yes | ||
| dry_run | Yes | ||
| link_ids | No | ||
| payload_preview | No |