通过编程添加JIRA链接到Confluence页面

发布于 2025-01-23 22:32:07 字数 1013 浏览 1 评论 0原文

我设法通过编程方式创建了一个与PowerShell的Confluence页面。现在,我想在页面内添加到JIRA票的链接。

$Headers = @{
    "Authorization" = "Basic xxxxxxxx";
    "Origin" = "https://mydomain.atlassian.net"
}

$Uri = "https://mydomain.atlassian.net/wiki/rest/api/content"

$Body = @{
    "type" = "page"
    "title" = "Test Page"
    "space" = @{
         "key" = "MYSPACE"
    }
    "ancestors" = @(
        @{
         "id" = 1234567
        }
    )
    "body" = @{
         "storage" = @{
              "value" = '<ri:shortcut ri:key="jira" ri:parameter="ISSUE-1234"/>'
              "representation" = "storage"
         }
    }
}

$Body = $Body | ConvertTo-Json 

Invoke-RestMethod -Headers $Headers -Method POST -Uri $Uri -ContentType "application/json; charset=UTF-8" -Body ([System.Text.Encoding]::UTF8.GetBytes($Body)) 

存储格式记录在这里显示在页面上。它无法识别&lt; ri:快捷方式&gt;元素...

I've managed to create a confluence page with powershell programmatically. Now I want to add a link to a jira ticket inside the page.

$Headers = @{
    "Authorization" = "Basic xxxxxxxx";
    "Origin" = "https://mydomain.atlassian.net"
}

$Uri = "https://mydomain.atlassian.net/wiki/rest/api/content"

$Body = @{
    "type" = "page"
    "title" = "Test Page"
    "space" = @{
         "key" = "MYSPACE"
    }
    "ancestors" = @(
        @{
         "id" = 1234567
        }
    )
    "body" = @{
         "storage" = @{
              "value" = '<ri:shortcut ri:key="jira" ri:parameter="ISSUE-1234"/>'
              "representation" = "storage"
         }
    }
}

$Body = $Body | ConvertTo-Json 

Invoke-RestMethod -Headers $Headers -Method POST -Uri $Uri -ContentType "application/json; charset=UTF-8" -Body ([System.Text.Encoding]::UTF8.GetBytes($Body)) 

The storage format is documented here but unfortunatly the issue is not displayed on the page. It does not recognize the <ri:shortcut> element...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别想她 2025-01-30 22:32:07

我设法通过Wiki Markup添加了jira票的链接

"storage" = @{
   "value" = '{jira:ISSUE-1234}'
   "representation" = "wiki"
}

I have managed to add a link to the jira ticket via Wiki Markup

"storage" = @{
   "value" = '{jira:ISSUE-1234}'
   "representation" = "wiki"
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文