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...