Hi, i am trying to create a ticket via the v2 API on powershell. It has so far worked fine but if I add the ‘id’ attribute (because I want to set the ticket id so i can call it later) it returns code 400 like below:
$Attributes = @{}
$Attributes.Add('id',1000)
$Attributes.Add('workspace_id',2)
$Attributes.Add('subject',"[JIRA Migrated] imported from API 3")
$Attributes.Add('requester_id',22000134116)
$Attributes.Add('description',"Test description")
$Attributes.Add('status',2)
$Attributes.Add('source',2)
$Attributes.Add('priority',1)
$JSON = $Attributes | ConvertTo-Json
$JSON
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $URL -Headers $HTTPHeaders -Body $JSON -Method Post```
RESPONSE:
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
At C:\
+ Invoke-WebRequest -Uri $URL -Headers $HTTPHeaders -Body $JSON -Method ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExce
ption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Like i said i just want to preset the ticket id on creation. am i doing something wrong here? any suggestions? thanks.