I am trying to invoke VSTS release API using powershell but below error message displayed. When i run the api in postman then it is working fine.
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"VS402903: The specified value is not convertible to type ReleaseStartMetadata. Make sure it is convertible to type ReleaseStartMetadata and try again.","typeName":"Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException, Microsoft.VisualStudio.Services.ReleaseManagement2.Data","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000} At C:\Users\Raj.Negi\Desktop\PowerShell\TriggerVSTSrelease.ps1:35 char:11 + $result = Invoke-RestMethod -Uri $uri -Method POST -Body $params -Hea ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand Unable to locate Release Definition Id 860 At C:\Users\Raj.Negi\Desktop\PowerShell\TriggerVSTSrelease.ps1:40 char:6 + throw "Unable to locate Release Definition Id $($definitionId)" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Unable to locat...finition Id 860:String) [], RuntimeException + FullyQualifiedErrorId : Unable to locate Release Definition Id 860
Powershell Code :
Param(
   [string]$vstsAccount = "demo",
   [string]$projectName = "Enterprise",
   [string]$definitionId = "860",
   [string]$keepForever = "true",
   [string]$personalAccessToken  = "asdfasdf"
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($personalAccessToken)")) }
# Construct the REST URL
$uri = "https://$vstsAccount.vsrm.visualstudio.com/$projectName/_apis/release/releases?api-version=5.0-preview.3"
Write-Host "Uri :" $uri
$params = 
'[
{
    "definitionId": 860,
    "description": "Create Release from postman.",
    "artifacts": [],
    "isDraft": false,
    "reason": "Demo purpose",
    "manualEnvironments": null,
    "environmentsMetadata": null, 
    "properties": null, 
    "variables": null
}
]'
Write-Host " Json Body :" $params
# Invoke the REST call and capture the results
$result = Invoke-RestMethod -Uri $uri -Method POST -Body $params -Headers $headers -ContentType "application/json" -Verbose -Debug
# This call should only provide a single result; Capture the Build ID from the result
if ($result.count -eq 0)
{
     throw "Unable to locate Release Definition Id $($definitionId)"
}
else
{
    Write-host "Success!!!"
}
Postman Request :
{
    "definitionId": 860,
    "description": "Create Release from postman.",
    "artifacts": [],
    "isDraft": false,
    "reason": "Demo purpose",
    "manualEnvironments": null
}
    

[ ]as well as{ }? - Josh Gust