Hi,
I am trying to create ticket using REST API from C# httpClient but I keep getting:
RT/5.0.0 200 Ok
# Required: id, Queue
Here is my implementation:
using (var httpClient = new HttpClient(handler) { BaseAddress = baseAddress })
{
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("token", "my-auth-token");
//param.Request is the CreateTicketRequest class
var content = new StringContent(JsonConvert.SerializeObject(param.Request));
var createResponse = await httpClient.PostAsync("REST/1.0/ticket/new", content);
var createdTicketStr = await createResponse.Content.ReadAsStringAsync();
}
This is my CreateTicketRequest class:
public class CreateTicketRequest
{
public CreateTicketRequest()
{
id = "ticket/new";
}
public string id { get; set; }
public string Queue { get; set; }
public string Requestor { get; set; }
public string Subject { get; set; }
public string Cc { get; set; }
public string AdminCc { get; set; }
public string Status { get; set; }
public int Priority { get; set; }
public string Text { get; set; }
}
Did anyone else face the same issue? Any help would be appreciated.
Thanks in advance.