Adding an attachemnt via REST 1.0 with c# .NET 5.0

So I managed to use the the REST API to create and update tickets with some problems in the beginning but now its working fine.
Now I just wanted to add an attachment to an exisiting ticket and here I got an error message which not really gets me anywhere:

no value sent for required parameter ‘changes’
Stack:
[/opt/rt4/share/html/REST/1.0/dhandler:285]
[/opt/rt4/share/html/REST/1.0/autohandler:54]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:681]
[/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:369]
[/opt/rt4/share/html/autohandler:53]

and my code:

    public string RT_REST_POST_Attachment(string request, string TicketID,IFormFile file)
    {
        string result = "";
        var RT_URL = configuration.GetValue<string>("RT_Config:URL");
        if (GlobalVariables.RT_Cookie == null)
        {
            GlobalVariables.RT_Cookie = new CookieContainer();
            RT_Login();
        }
        using (var handler = new HttpClientHandler { CookieContainer = GlobalVariables.RT_Cookie })
        using (var client = new HttpClient(handler))
        {
            using (var formData = new MultipartFormDataContent())
            {
                formData.Add(new StringContent("id: "+TicketID+ Environment.NewLine+" Action: comment" + Environment.NewLine +" Attachment: "+file.FileName+ Environment.NewLine+" Text: Attachment added"), "content");
                formData.Add(new StreamContent(file.OpenReadStream()), "attachment_1");
                client.DefaultRequestHeaders.Add("Referer", RT_URL);
                result = client.PostAsync(RT_URL + "/REST/1.0/" + request, formData).Result.Content.ReadAsStringAsync().Result;
            }
        }
        return result;
    }

Any help tips or tricks are highly appreciated.

Regards Martin

Which endpoint are you hitting?

I managed to get it working with the RESTSharp Client:

[HttpPost]
public string RT_REST_POST_Attachment(string requeststring, string TicketID,IFormFile file)
{
    var filepath = webenv.WebRootPath + "/images/" + file.FileName;
    string contentType;
    new FileExtensionContentTypeProvider().TryGetContentType(filepath, out contentType);
    contentType= contentType ?? "application/octet-stream";
    var RT_URL = configuration.GetValue<string>("RT_Config:URL");
    if (GlobalVariables.RT_Cookie == null)
    {
        GlobalVariables.RT_Cookie = new CookieContainer();
        RT_Login();
    }
    var client = new RestClient(RT_URL + "/REST/1.0/" + requeststring);
    client.Timeout = -1; using (var stream = System.IO.File.Create(filepath))
    {
        file.CopyTo(stream);
    }
    var request = new RestRequest(Method.POST);
    request.AddHeader("Referer", RT_URL);
    request.AddHeader("Cookie", GlobalVariables.RT_Cookie.GetCookies(new Uri(RT_URL)).First().ToString());
    request.AddFile("attachment_1", webenv.WebRootPath + "/images/" + file.FileName, contentType);
    string content = "id: " + TicketID + "\nAction: comment\nAttachment: " + file.FileName;
    request.AddParameter("content",content);
    IRestResponse response = client.Execute(request);
    string result = response.Content;
    return result;
}