- Products
- Learn
- Local User Groups
- Partners
- More
Firewall Uptime, Reimagined
How AIOps Simplifies Operations and Prevents Outages
Introduction to Lakera:
Securing the AI Frontier!
Check Point Named Leader
2025 Gartner® Magic Quadrant™ for Hybrid Mesh Firewall
HTTPS Inspection
Help us to understand your needs better
CheckMates Go:
SharePoint CVEs and More!
I'm using sandBlast api, when I upload to the cloud all is fine, but when I try to upload to local gateway I receive
code:1008,label:BAD_REQUEST, message: Invalid Multipart/form request
Why?
I'm not sending cookie to local gateway, I'm using CSharp.
I found the same issue here, but there is no answer yes, please If you can share a working code example for c# in local gateway.
Hi, I succeeded to upload to a local server using the RestSharp, (With HttpClient I succeeded to upload to the cloud but not to a local server, can't tell why)
Add reference to RestSharp dll and try this code:
async Task UploadAsync()
{
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
var client = new RestClient("https://xxx.xxx.xxx.xxx:1234/tecloud/api/v1/file/upload");
var request = new RestRequest(Method.POST);
string path = @"C:\Users\nehorai_elbaz\test.png";
string json = "{\"request\":"
+ "{"
+ $"\"file_name\": \"{Path.GetFileName(path)}\","
+ $"\"file_type\": \"{Path.GetExtension(path)}\","
+ "\"features\": [\"te\"],"
+ "\"te\": {\"reports\": [\"tar\"]}"
+ "}"
+ "}";
request.AddParameter("request", json);
request.AddFileBytes("file",File.ReadAllBytes(path), "test.png");
IRestResponse response = await client.ExecuteTaskAsync(request);
Console.WriteLine(response.Content);
}
Please let me know if it works
So when not using API calls, but the local CLI, upload to local sandblast appliance works ?
I am using This guide, there is no CLI here, can you share CLI guide? I will try
That is easy - most of it can be found here: sk114806 ATRG: Threat Emulation. How to manually emulate a file you can find in sk110375 How to emulate files manually on the SandBlast TE Appliance?
That what I see when I click the links the you mentioned
You may check this script to also get an idea how the API call looks for a local SB appliance:
https://community.checkpoint.com/docs/DOC-3091-using-sandblast-api-from-commandline
Can you also please post your full API request ?
Regards Thomas
I was succeeded to upload file to the gateway via SandBlast Chrome extension, but not via code.
I also was succeeded to perform a query from code to the local gateway.
But it fails when I try to upload a file to local gateway it always return "Bad request" "Invalid Multipart/form request", I have added my C# code:
static void Main(string[] args)
{
MainAsync(args).Wait();
}
static async Task MainAsync(string[] args)
{
string json = "{\r\n\t\"request\": {\r\n\t\t\"md5\": \"44D88612FEA8A8F36DE82E1278ABB02F\",\r\n\t\t\"file_name\": \"TestEicar.pdf\",\r\n\t\t\"file_type\": \"pdf\",\r\n\t\t\"features\": [\"te\"],\r\n\t\t\"te\": {\r\n\t\t\t\"reports\": [\"pdf\", \"xml\"],\r\n\t\t\t\"images\": [{\r\n\t\t\t\t\"id\": \"7e6fe36e-889e-4c25-8704-56378f0830df\",\r\n\t\t\t\t\"revision\": 1\r\n\t\t\t}, {\r\n\t\t\t\t\"id\": \"e50e99f3-5963-4573-af9e-e3f4750b55e2\",\r\n\t\t\t\t\"revision\": 1\r\n\t\t\t}]\r\n\t\t}\r\n\t}\r\n}";
Console.WriteLine(json);
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var path = @"C:\Users\066570516\Desktop\TempEicar.pdf";
var url = "https://172.45.1.122:18194/tecloud/api/v1/file/upload";
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "MyAPIKEY");
//add json byte array to mulipart
MultipartFormDataContent form = new MultipartFormDataContent("----WebKitFormBoundary7MA4YWxkTrZu0gW");
byte[] jsonByte = Encoding.ASCII.GetBytes(json);
var jsonContent = new ByteArrayContent(jsonByte);
jsonContent.Headers.Add("Content-Disposition", "form-data; name=\"request\"");
jsonContent.Headers.Add("Content-Type", "application/json");
form.Add(jsonContent);
//add file stream to multipart
FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
var streamContent = new StreamContent(fs);
streamContent.Headers.Add("Content-Disposition", "form-data; name=\"file\"; filename=\"" + Path.GetFileName(path) + "\"");
streamContent.Headers.Add("Content-Type", "application/pdf");
form.Add(streamContent);
HttpResponseMessage response = await httpClient.PostAsync(url, form);
response.EnsureSuccessStatusCode();
httpClient.Dispose();
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
Hi Ploni,
is there a way that you can extract/show the pure JSON request that is generated by your code ?
I am not too good in reading C# code 🙂
Regards Thomas
And here is the text:
{
"request": {
"md5": "44D88612FEA8A8F36DE82E1278ABB02F",
"file_name": "TestEicar.pdf",
"file_type": "pdf",
"features": ["te"],
"te": {
"reports": ["pdf", "xml"],
"images": [{
"id": "7e6fe36e-889e-4c25-8704-56378f0830df",
"revision": 1
}, {
"id": "e50e99f3-5963-4573-af9e-e3f4750b55e2",
"revision": 1
}]
}
}
}
For testing can you strip down your request to:
{
"request": {
"features": ["te"],
"te": {
"reports": ["pdf", "xml"],
"images": [{
"id": "7e6fe36e-889e-4c25-8704-56378f0830df",
"revision": 1
}, {
"id": "e50e99f3-5963-4573-af9e-e3f4750b55e2",
"revision": 1
}]
}
}
}
Regards Thomas
Hi, I am still getting "BAD REQUEST" as reponse
Hi Nehorai,
to see if the appliance API itself has a problem could you please try to send the API request and file through Postman tool ? Postman | API Development Environment
I assume your problem is how the file is uploaded by your code ...
Regards Thomas
Hi Iron,
Have you found the solution ? I am facing the same issue like you. hope you share knowledge if you found it.
BR,
Soo
Yes I succeded, I will add my github repo/ or a code snippet soon
Hello
Could You update us with repo link or explain how to resolve BAD REQUEST error to local Appliance?
Hi, I succeeded to upload to a local server using the RestSharp, (With HttpClient I succeeded to upload to the cloud but not to a local server, can't tell why)
Add reference to RestSharp dll and try this code:
async Task UploadAsync()
{
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
var client = new RestClient("https://xxx.xxx.xxx.xxx:1234/tecloud/api/v1/file/upload");
var request = new RestRequest(Method.POST);
string path = @"C:\Users\nehorai_elbaz\test.png";
string json = "{\"request\":"
+ "{"
+ $"\"file_name\": \"{Path.GetFileName(path)}\","
+ $"\"file_type\": \"{Path.GetExtension(path)}\","
+ "\"features\": [\"te\"],"
+ "\"te\": {\"reports\": [\"tar\"]}"
+ "}"
+ "}";
request.AddParameter("request", json);
request.AddFileBytes("file",File.ReadAllBytes(path), "test.png");
IRestResponse response = await client.ExecuteTaskAsync(request);
Console.WriteLine(response.Content);
}
Please let me know if it works
Leaderboard
Epsum factorial non deposit quid pro quo hic escorol.
User | Count |
---|---|
16 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 |
Tue 07 Oct 2025 @ 10:00 AM (CEST)
Cloud Architect Series: AI-Powered API Security with CloudGuard WAFThu 09 Oct 2025 @ 10:00 AM (CEST)
CheckMates Live BeLux: Discover How to Stop Data Leaks in GenAI Tools: Live Demo You Can’t Miss!Thu 09 Oct 2025 @ 10:00 AM (CEST)
CheckMates Live BeLux: Discover How to Stop Data Leaks in GenAI Tools: Live Demo You Can’t Miss!Wed 22 Oct 2025 @ 11:00 AM (EDT)
Firewall Uptime, Reimagined: How AIOps Simplifies Operations and Prevents OutagesAbout CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY