get_work_package_relations
Retrieve a work package's relations—such as blocks, duplicates, or relates to—with stored direction IDs and a caller-perspective reading to clarify actual relation direction.
Instructions
Get the relations of one work package (blocks, relates to, duplicates, etc.).
type/from_id/to_id reflect how OpenProject actually stored the relation, which does not depend on which work package's relations you query, but can differ from how it was originally requested, since OpenProject canonicalizes some relation types at creation time (e.g. a relation requested as 'precedes' is stored as 'follows' with from_id/to_id swapped; see create_work_package_relation). Use from_id/to_id together with type, not the request you expect to have made, to determine the actual direction.
Each result additionally carries queried_perspective, a caller-relative reading of the same relation from work_package_id's own side; never a replacement for type/from_id/to_id, which stay unchanged. queried_perspective.direction is "from" or "to" (which raw id equals work_package_id); queried_perspective.effective_type is the type as read FROM work_package_id's side (e.g. a stored "blocks" relation reads as effective_type="blocked" when work_package_id is the to_id side, "blocks" when it's the from_id side). queried_perspective.predecessor_id/successor_id are populated only for the precedes/follows type pair (OpenProject's own scheduling-relevant relation types); both stay null for every other type, since no other type has an equivalent first/second concept.
total is only the count of allowed relations returned on THIS page, not a full count of all matches; the search stops as soon as it has enough, so an exact total would need an extra full walk. Page until next_offset is null.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Page size, capped at OPENPROJECT_MAX_PAGE_SIZE. | |
| offset | No | 1-based page number; pass the previous result's next_offset. | |
| select | No | Fields to return; a requested unset field comes back as null. Allowed: description, description_length, description_truncated, from_id, from_subject, id, queried_perspective, to_id, to_subject, type. | |
| work_package_id | Yes | Work package id (e.g. 952) or display id (e.g. "PROJ-51"), not the bare number 51. |