Hi
I have a problem in my webclient when i try to include an attachment in my request
I’m using RestSharp to create and send the request
and here is the code
var client = new RestClient();
client.BaseUrl = new Uri("localhost/REST/1.0/ticket/" + ticketId + "/comment");
var request = new RestRequest();
request.AddParameter("user", user);
request.AddParameter("pass", pwd);
request.AddParameter("content", "id: " + ticketId + "\nAction: comment\nText: This is a test comment\nAttachment: test.PNG");
request.AddFile("attachment_1", @"C:\Users\user\Desktop\test.PNG");
var asyncHandler = client.ExecuteAsync(request, r =>
{
if (r.ResponseStatus == ResponseStatus.Completed)
{
Console.WriteLine(r.Content);
}
})
the response i get back is
RT/4.2.5 400 Bad Request
# No attachment for test.PNG
Without the attachment included the code work as expected and RT register a comment
i’m at a loss here and appriciate any help
Kind regards
John