Troubleshoot/debug error updating Service Manager via REST API: (400) Bad Request

I'm attempting to update a value in Service Manager using a REST API, but when I attempt it I receive an error:

Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request."

Is there a way to get more information about what is causing this error or otherwise debug?

The code in question (username and password redacted for security reasons, but I've confirmed they're correct)

######################################
#Function to create the JSON object
######################################
function AddJsonToRequest {
 param($rq, $body);
 $bodyStream = $rq.GetRequestStream();
 $bodyWriter = New-Object System.IO.StreamWriter($bodyStream);
 $bodyWriter.Write($body);
 $bodyWriter.Close();
 $bodyStream.Close();
}

########################################
#Writing back to the HPSM Task record
########################################

$cred = "<username>:<password>";
$cred = [System.Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($cred);
$cred = [System.Convert]::ToBase64String($cred);
$url = ("{0}/SM/9/rest/xcelrequesttasks/{1}/action/Update" -f $baseHpsmUrl, $taskId);
$rq = [System.Net.WebRequest]::Create($url);
$rq.Method = "POST";
$rq.ContentType = "application/json";
$rq.Timeout = 100000;
$rq.ReadWriteTimeout = 100000;
$rq.Headers.Add("Authorization", "Basic " $cred);

LogWrite ("URL: {0}" -f $url);
LogWrite ("rq: {0}" -f $rq);

if($finalStatus -eq "ok") {
 $xcelDataCollectYesNo="No";
 $ClosureCode = '1';
} else {
 $xcelDataCollectYesNo="Yes";
 $ClosureCode = '3';
}

$ClosureComments = [string]::Join(" ", $comments);
$ClosureComments = $ClosureComments -replace '"', ""
$ClosureComments = $ClosureComments -replace '\\', ""

$body = '{{ "RequestTask": {{ "xcelDataCollectYesNo":{0}, "ClosureCode":{1}, "ClosureComments":"{2}" }}}} ';
$body = ($body -f $xcelDataCollectYesNo, $ClosureCode, $ClosureComments );

AddJsonToRequest $rq $body
$rq.GetResponse();