I'm trying to update an incident via RestAPI within my C# application, but i get an error message: {"status":500,"message":"null"}
Below you can see what code i use
public void saUpdateTicket(string saTicket, string TDTicket)
{
string someUser = "********";
string someAccount = "*******";
string somePass = "*********";
SysaidUpdate saUpdate = new SysaidUpdate();
saUpdate.id = saTicket;
var objLogin = new Login(someUser, someAccount, somePass);
var client = new RestClient("https://<SERVER>:8443/api/v1");
var loginRequest = new RestRequest("login", Method.POST);
loginRequest.AddJsonBody(objLogin);
var responseLogin = client.Execute(loginRequest);
client.CookieContainer = new System.Net.CookieContainer();
var authCookie = responseLogin.Cookies.First(a => a.Name == "JSESSIONID");
client.CookieContainer.Add(new System.Net.Cookie(authCookie.Name, authCookie.Value, authCookie.Path, authCookie.Domain));
List<saUpdateInfo> saInfo = new List<saUpdateInfo>();
saInfo.Add(new saUpdateInfo { key = "CustomColumn3sr", value = TDTicket});
saUpdate.info = saInfo;
string json = JsonConvert.SerializeObject(saUpdate);
StringContent content = new StringContent(json, Encoding.UTF8, "application/json");
string input = @"/" + saTicket;
var getUserRequest = new RestRequest($"sr{input}", Method.PUT);
getUserRequest.AddJsonBody(content);
var result = client.Execute(getUserRequest);
string r = result.Content.ToString();
}
Any help would be great.
Thanks in advance.
Edward