Attach CSV Report to Page Approval Activity

Attach CSV Report to Page Approval Activity

You can use the following POST REST API endpoint to attach a CSV report containing the Page Approval Activity to a specific Confluence page:

POST {baseUrl}/rest/pageApprovals/1/report/attachCSV/{pageId}

Path Parameter:

  • {pageId} – The ID of the Confluence page where the report should be attached.

Response:

  • The endpoint returns a jobId representing the long-running background task handling the operation.

Example Response:

{ "jobId": "3df48d87-13df-47b7-82bb-1eb9f8602ac8" }

To check the status of a long-running task, use the following GET REST API endpoint in Confluence:

{baseUrl}/rest/api/longtask/{job ID}

The response from this endpoint provides details about the long-running task associated with the specified jobId.
The task is considered completed when:

  • "percentageComplete" is 100

  • "successful" is true

These values indicate that the background job has finished without errors.

{ "id": "3df48d87-13df-47b7-82bb-1eb9f8602ac8", "name": { "translation": "Attach activity csv", "args": [] }, "elapsedTime": 119, "percentageComplete": 100, "successful": true, "_links": { "base": "http://localhost:9040/confluence", "context": "/confluence" } }

Once the job is complete, a CSV file named according to a predefined format will be automatically attached to the specified Confluence page.

CSV Report

Each row in the CSV represents a single user’s approval action, providing a detailed record of who approved the content, when, and under what conditions.

The generated CSV file includes the following columns:

  • Approver – The name of the approver

  • Approval Date – The timestamp indicating when the approval occurred.

  • Comment – Any comment provided by the approver during the approval.

  • Page Version – The Confluence page version at the time of the approval.

  • Approved Version – Indicates whether the page version was approved by all assigned reviewers.

image-20250514-183805.png

CSV name Format

The generated CSV file uses the following naming convention:

PA_pagePAGEID_CURRENTDATE_TIME_CURRENTMILLIS.csv

  • PAGEID – The unique identifier of the Confluence page.

  • CURRENTDATE – The date the CSV file was generated

  • TIME – The time the CSV was generated

  • CURRENTMILLIS – The current time in milliseconds, used to ensure filename uniqueness.

image-20250514-184350.png