I'm trying to upload some file to some api, I made a small test with postman, the video of this guy helped me. it works fine!.
Therefore I copied the code from postman, it is possible by clicking the "Code":
Here is the C# code that postman use:
var client = new RestClient("https://te.checkpoint.com/tecloud/api/v1/file/upload");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "616790a7-ad25-4687-a749-0b36998b04ac");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "6610F8512D02");
request.AddHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
request.AddParameter("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW", "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"C:\\Users\\Plompy\\Downloads\\rr.pdf\"\r\nContent-Type: application/pdf\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
But when I try from C# console app I recive the response (RestSharp DLL from NuGet is needed)::
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
I don't care about that you see my autorithetion key. It's a free 30 days trial account.