Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow version comment to be included in Set-ConfluencePage #207

Open
hkelley opened this issue Oct 11, 2023 · 1 comment
Open

Allow version comment to be included in Set-ConfluencePage #207

hkelley opened this issue Oct 11, 2023 · 1 comment

Comments

@hkelley
Copy link

hkelley commented Oct 11, 2023

I saw the older issue #22 which seems to have been closed pending some API enhancements. From what I can see today, this method,

https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-wiki-rest-api-content-id-put

accepts a version object with a message property. Can this request be incorporated now?

@hkelley hkelley changed the title Allow comment to be included in Set-ConfluencePage Allow version comment to be included in Set-ConfluencePage Oct 11, 2023
@JoseAPortilloJSC
Copy link

JoseAPortilloJSC commented Aug 27, 2024

The feature could be easily included just by adding 1 line of code:

(based on ConfluencePS 2.5.1 module, ConfluencePS.psm1)
(valid for the "byObject" ParameterSetName, i.e. piping the page to the cmdlet, or passing the page as -InputObject)

Before

function Set-Page {
...
        switch ($PsCmdlet.ParameterSetName) {
            "byObject" {
                $iwParameters["Uri"] = $resourceApi -f $InputObject.ID
                $Content.version.number = ++$InputObject.Version.Number
                $Content.title = $InputObject.Title
                $Content.body.storage.value = $InputObject.Body

After

function Set-Page {
...
        switch ($PsCmdlet.ParameterSetName) {
            "byObject" {
                $iwParameters["Uri"] = $resourceApi -f $InputObject.ID
                $Content.version.number = ++$InputObject.Version.Number
                $Content.version.message = $InputObject.Version.Message       # THIS LINE
                $Content.title = $InputObject.Title
                $Content.body.storage.value = $InputObject.Body

Usage example:

$page = Get-ConfluencePage -PageID $pageId
$page.Body = ...
$page.Version.Message = "Updated by Octopus Deploy on $utcNow, deployed by $operatorName"
$page | Set-ConfluencePage

Locally patching the module (search for it on PSModulePath) leads to the desired result:

imagen

Could this be implemented? This is super useful for automated content updates.
Thank you
Jose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants