I am trying to make some API calls through powershell using this documentation https://octopus.com/blog/manually-push-build-information-to-octopus
$Headers = @{"X-Octopus-ApiKey"=$MYKEY"}
$jsonBody = @{
PackageId = "Test"
Version = "1.1.1"
OctopusBuildInformation =
@{
BuildEnvironment = "Jenkins"
BuildNumber = "1"
BuildURL = "myURL"
VcsCommitNumber = "250"
VcsType = "Git"
Commits = [{Id = "250" LinkUrl = "gitUrl" Comment = "someComment"}]
VcsRoot = "gitUrl"
}
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method Post -Uri "http://alfadeployment/api/build-information" -Headers $Headers -Body $jsonBody
However, since I added the commits array, I am getting the following error:
Missing type name after '['.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingTypename