Hi- I've been banging my head up against the wall attempting to create a deployment release via API call from a PowerShell script. (Nearly all of my attempts at retrieving via GET to Bamboo APIs are succeeding; just this POST that is killing me).
My Powershell script which accepts Method (ie. Get or Post) and URI is below.
The URI I'm passing is: http://<bamboo server>/rest/api/latest/deploy/project/<project id>/version.json
The project ID I am passing is correct and verified with other GET calls
param([string]$method, [string]$uri)
$user = "<my user name>"
$pass = "<my pass>"
$pair = "${user}:${pass}"
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$basicAuthValue = "Basic $base64"
$headers = @{ Authorization = $basicAuthValue }
$body = @"
{
"planResultKey": "UAT-TEST-111",
"name": "release-7"
}
Invoke-RestMethod -method $method -body $body -uri $uri -Headers $headers -ContentType "application/json"
So after all the credentials are verified (this works great with other Bamboo APIs) I am in essence running:
Invoke-RestMethod -method post -body $body -uri http://<bamboo server>/rest/api/latest/deploy/project/<project id>/version.json -Headers $headers -ContentType "application/json"
I get "The remote server returned an error: (404) Not Found."
Please advise. Thanks!!