I can use the following curl command to update the custom field value.
curl --request PUT --url "https://<tenant_name>.atlassian.net/rest/api/3/issue/<issue_name>" --user "username@domain.com:<api_key>" --header "Accept: application/json" --header "Content-Type: application/json" --data "{""update"": {""customfield_10053"": [{""set"": ""123""}]}}"
But when I attempt to use the following PowerShell script it returns, "(400) Bad Request".
$headers = @{
Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($apiToken)"))
Accept = "application/json"
"Content-Type" = "application/json"
}
$body = @{
update = @{
"customfield_10053" = @(
@{
set = "123"
}
)
}
} | ConvertTo-Json
Invoke-RestMethod -Uri "$jiraUrl/rest/api/3/issue/$issueKey" -Method Put -Headers $headers -Body $body
How can I get this to work?