arazzo: 1.0.1 info: title: Confluence Archive or Retire a Page summary: Check a page for children, archive it, and only trash or purge it when explicitly confirmed. description: >- Retiring a page is the operation most likely to destroy something someone still needs, so this flow front-loads the checks. It reads the page, lists its children so an orphaned subtree is visible before anything is retired, archives the page to take it out of circulation reversibly, and only then branches: the default stops at archived, a trash action moves it to the recycle bin where it can be restored, and a purge is permanent. Purge is never reached without being asked for explicitly. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: confluenceCloudV2 url: ../openapi/confluence-cloud-v2.yml type: openapi workflows: - workflowId: retire-page summary: Archive a Confluence page, optionally trashing or permanently purging it. description: >- Reads a page and its children, archives it, and applies a delete only when the caller asks for trash or purge rather than archival. inputs: type: object required: - pageId - newVersionNumber - retireAction properties: pageId: type: string description: The id of the page to retire. newVersionNumber: type: integer description: >- The version number to write when archiving, which Confluence requires to be the current version plus one. Arazzo runtime expressions have no arithmetic, so the caller supplies this value; readPage returns currentVersion to compute it from. retireAction: type: string description: >- One of "archive" to stop at archived, "trash" to move the page to the recycle bin where it can be restored, or "purge" to delete it permanently. versionMessage: type: string description: Changelog message explaining the retirement, recorded on the new version. steps: - stepId: readPage description: >- Read the page to capture its title, space, body, and the current version that the archive write must supersede. operationId: getPageById parameters: - name: id in: path value: $inputs.pageId - name: body-format in: query value: storage successCriteria: - condition: $statusCode == 200 outputs: title: $response.body#/title spaceId: $response.body#/spaceId parentId: $response.body#/parentId currentVersion: $response.body#/version/number body: $response.body#/body - stepId: checkForChildren description: >- List the page's children before retiring it. Retiring a parent strands whatever hangs beneath it, so this is the check that should stop a careless purge. operationId: getChildPages parameters: - name: id in: path value: $inputs.pageId - name: limit in: query value: 250 successCriteria: - condition: $statusCode == 200 outputs: children: $response.body#/results - stepId: archivePage description: >- Set the page's status to archived, which removes it from circulation while keeping it and its history addressable and restorable. operationId: updatePage parameters: - name: id in: path value: $inputs.pageId requestBody: contentType: application/json payload: id: $inputs.pageId status: archived title: $steps.readPage.outputs.title spaceId: $steps.readPage.outputs.spaceId body: representation: storage value: $steps.readPage.outputs.body version: number: $inputs.newVersionNumber message: $inputs.versionMessage successCriteria: - condition: $statusCode == 200 outputs: pageId: $response.body#/id pageStatus: $response.body#/status versionNumber: $response.body#/version/number onSuccess: - name: archiveOnly type: end criteria: - condition: $inputs.retireAction == 'archive' - name: trashRequested type: goto stepId: trashPage criteria: - condition: $inputs.retireAction == 'trash' - name: purgeRequested type: goto stepId: purgePage criteria: - condition: $inputs.retireAction == 'purge' - stepId: trashPage description: >- Move the archived page to the trash, where Confluence retains it and an administrator can still restore it. operationId: deletePage parameters: - name: id in: path value: $inputs.pageId - name: purge in: query value: false successCriteria: - condition: $statusCode == 204 outputs: trashedPageId: $inputs.pageId onSuccess: - name: done type: end - stepId: purgePage description: >- Permanently delete the page. This is irreversible and is only reached when the caller explicitly asked to purge rather than archive or trash. operationId: deletePage parameters: - name: id in: path value: $inputs.pageId - name: purge in: query value: true successCriteria: - condition: $statusCode == 204 outputs: purgedPageId: $inputs.pageId outputs: pageId: $inputs.pageId children: $steps.checkForChildren.outputs.children archivedStatus: $steps.archivePage.outputs.pageStatus trashedPageId: $steps.trashPage.outputs.trashedPageId purgedPageId: $steps.purgePage.outputs.purgedPageId