How to set additional fields when adding worklog via REST API

How to set additional fields when adding worklog via REST API

I can successfully add a worklog entry via the REST API in a powershell script, but I'm having trouble setting the user defined fields.
My input data looks like this - I'm trying to set the second character field we've defined. Is UDF_CHAR2 the correct name to use? UDF_CHAR2 is never set, while everything else is OK.
$inputdata = @"
{
"operation": {
"details": {
"worklogs": {
"worklog": {
"technician": "$($task.Fields["Assigned To"].Value)",
"description": "$($description)",
"workHours": "$($hours)",
"workMinutes" : "$($minutes)",
"executedTime": "$($startDate)",
"UDF_CHAR2": "$($task.ID)"
}
}
}
}
}
"@

                  New to ADSelfService Plus?