When trying to access the API to create a build, a release and deploy, you receive a number of errors that don't meet the specification:
Ok, lets start by getting the releases of all the applications
Invoke-WebRequest -Uri "http://localhost:8622/api/releases?key=test" -Method Get
#Invoke-WebRequest : Object reference not set to an instance of an object.
#At line:1 char:1
#+ Invoke-WebRequest -Uri http://localhost:8622/api/releases?key=test -M ...
#+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
# + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Never mind, that didn't work, so instead lets go ahead and create a release against application ID by sending that in the POST body
Invoke-WebRequest -Uri "http://localhost:8622/api/releases/create?key=test" -Method POST -Body (@{ "applicationId" = 1 } | ConvertTo-Json)
#Invoke-WebRequest : An application name or ID is required.
#At line:11 char:1
#+ Invoke-WebRequest -Uri http://localhost:8622/api/releases/create?key= ...
#+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
# + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Oh, that didn't work. Never mind, let's send it via Params instead!
Invoke-WebRequest -Uri "http://localhost:8622/api/releases/create?applicationId=1&key=test" -Method POST
#Invoke-WebRequest : A pipeline name or ID is required.
#At line:19 char:1
#+ Invoke-WebRequest -Uri "http://localhost:8622/api/releases/create?app ...
#+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
# + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Ah I forgot the pipeline ID, so that's add that in. Only I don't have the ID because GET doesn't work so lets instead use the name
Invoke-WebRequest -Uri "http://localhost:8622/api/releases/create?applicationId=1&pipeLineName=Default%3A%3Atest%3A%3APipeline%3A%3ARelease&key=test" -Method POST
#StatusCode : 200
#StatusDescription : OK
#Content : {"id":1,"number":"0.0.0","name":"0.0.0","sequence":1,"status":"active","createdBy":"API","createdOn":"2024-02-02T19:34:11.5330000Z","applicationId":1
# ,"applicationName":"test","pipelineName":"Default::...
#RawContent : HTTP/1.1 200 OK
#{"id":1,"number":"0.0.0","name":"0.0.0","sequence"...
nice that worked! So lets create a build in that release
Invoke-WebRequest -Uri "http://localhost:8622/api/releases/builds/create?applicationId=1&releaseId=1&key=test" -METHOD POST
#StatusCode : 200
#StatusDescription : OK
#Content : {"id":1,"number":"1","status":"active","createdBy":"API","createdOn":"2024-02-02T19:35:59.5570000Z","applicationId":1,"applicationName":"test","pipel
# ineName":"Default::test::Pipeline::Release","releas...
Nice that worked too. We are getting somewhere here. Lets try and go and see that build in the web GUI so we can check progress before doing a deployment
Uh oh..........
Ok, lets try and create another build manually instead