I figured out that the 400 error was caused by required fields I wasn't accounting for in my request.
I posted a working example below of using a put request to update a request in case some one else wants to use C# to call rest in the future.
try
{
//////////////////////////////////////////////////////
// PUT OPERATION -- Update an existing Incident ticket
//////////////////////////////////////////////////////
string url = "https://servername:8050/caisd-rest";
string endpointPUT = url + "/cr/401552";
//create the body of the put request
string postBody = @"<cr>" +"<description>Updated from REST API Java Samples code</description>" +
"<summary>Updated from REST API Java Samples code</summary>" + "</cr>";
//encode it into bytes
byte[] dataByte = Encoding.ASCII.GetBytes(postBody);
//Create an HttpWebRequest and set the headers
HttpWebRequest put = (HttpWebRequest)WebRequest.Create(endpointPUT);
put.Method = "PUT";
put.Headers.Add("X-AccessKey", accessKey);
//set the accept property to return json. Accept is easier to use with HttpWebRequest than WebRequest
put.Accept = "application/json";
put.ContentType = "application/xml; charset=UTF-8";
//set the length of message body, it defaults to -1 meaning no data to send
put.ContentLength = dataByte.Length;
// Get a request stream to use to write data to the resource
Stream PUTstream = put.GetRequestStream();
// Write the byte data in the request stream to the resource
PUTstream.Write(dataByte, 0, dataByte.Length);
// Get the response back from the resource
HttpWebResponse PUTResponse = (HttpWebResponse)put.GetResponse();
//use a stream reader to get the response stream from the HttpWebResponse object
StreamReader reader = new StreamReader(PUTResponse.GetResponseStream(), false);
//response is the full response string converted to string
string response = reader.ReadToEnd().ToString();
//verify the response
Console.WriteLine(response);
}
catch (WebException e)
{
Console.WriteLine(e.ToString());
Console.Write(e.StackTrace);
}
catch (IOException e)
{
Console.WriteLine(e.ToString());
Console.Write(e.StackTrace);
}
finally
{
//release system resources here
}
}