how upload via api?
here the c# code:
var restClient = new RestSharp.RestClient(baseUrlApiV2);
var request = new RestSharp.RestRequest("/util/upload", RestSharp.Method.POST);
request.AlwaysMultipartFormData = true;
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("Authentication", token);
request.AddHeader("Authorization", token);
request.AddFile("file[]", @"D:\phpbbAtach\54_0df4f16285a8bce30059e548f506fdf1", "image/png");
IRestResponse response = restClient.Execute(request);
var content = response.Content.Dump();
the raw request:
POST http://mysite.com/api/v2/util/upload HTTP/1.1
Content-Type: multipart/form-data
Authentication: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml
User-Agent: RestSharp/106.2.1.0
Host: tchumim.com
Content-Length: 24977
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
-------------------------------28947758029299
Content-Disposition: form-data; name="files[]"; filename="54_0df4f16285a8bce30059e548f506fdf1"
Content-Type: image/png
......
-------------------------------28947758029299--
the response (401):
{"code":"not-authorised","message":"A valid login session was not found. Please log in and try again.","params":{}}