I am trying to create page from template using powershell in yaml pipeline.
Write-Host "URL: $urlGetTemplate"
$username = "?????????"
$password = "?????????"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$headers = @{
'Authorization' = 'Basic ' + $base64AuthInfo
'X-Atlassian-Token' = 'no-check'
'Connection' = 'keep-alive'
}
Write-Host "base64AuthInfo:" $base64AuthInfo
[string]$templateObject = Invoke-RestMethod -Method Get -Uri $urlGetTemplate -ContentType "application/json" -Headers $headers
I dont get any error, but I get this empty template:
{
templateId=33980675;
originalTemplate=;
referencingBlueprint=com.atlassian.confluence.plugins.confluence-business-blueprints:file-list-blueprint@DOK;
name=File list;
description=Upload, preview and share files with your team.;
space=;
labels=System.Object[];
templateType=page;
editorVersion=v2;
body=;
_links=
}
I checked the same Request using postman and SoapUI and I get json with full template data. Can anybody tell me why Powershell Invoke-RestMethod gives me empty json without error?