通过编程添加JIRA链接到Confluence页面
我设法通过编程方式创建了一个与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))
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法通过Wiki Markup添加了jira票的链接
I have managed to add a link to the jira ticket via Wiki Markup