I can create a subtask fine following this documentation, JIRA REST API Example Create Issue 7897248 (atlassian.com). My current implementation sets a custom field to the due date value which is calculated previously in my script. However, when trying to set the native Due Date field and the priority field like I have in previous functions in my script, I get a 400 error as output.
If anyone can provide any insight on if the rest api can support doing this on creating of the subtask, if my payload format is wrong, or if I would have to implement a different solution to update the subtasks after they are created it would be greatly appreciated, thanks!
Here is my function as it is now.
function JiraSubtask ($issue, $next_review_date) {
$update_issue_url = "$jiraURL/rest/api/2/issue/"
$createSubtaskBody = {
fields = {
project = {
key = $projectKey
}
parent = {
key = $issue.key
}
summary = "This vendor is 21 days from their next review date $duedate"
description = "Please review this vendor's risk score and update the appropriate custom fields before $duedate"
issuetype = {
name = "Sub-task"
}
$subtask_duedate_id = $duedate
}
} | ConvertTo-Json
Write-Output $create_subtask_body
Invoke-RestMethod -Method Post -Uri $update_issue_url -Headers $headers -Body $createSubtaskBody -ContentType "application/json" -Verbose
}