Internal error during incident update via RestAPI in C#

  • 2 November 2021
  • 1 reply
  • 95 views

  • Anonymous
  • 0 replies
Hello,

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

1 reply

Userlevel 5
Badge
Hi Edward,

Try also reaching out directly to our Customer Care team to see if they guide you through this by email: support@sysaid.com or open a live chat with our reps >login to helpdesk > click on "chat with us box"

Hope you figure this out!
Best,
Maayan

Reply