Hi Przemyslaw
Apologies to not resolving your situation.
For REST API call from SOAR side, I have no further idea.
I guess that 400 Bad request may come from client request including post data.
If I were your situation, I may try curl with same post data. (<user>:<password> might be <api-key>:<api-secret>).
curl -X POST -sik -u '<user>:<password>' -d@<post_data_as_file_name> -H 'Content-Type application/json' https://api.manage.trellix.com/edr/v2/searches/realtime
I th400 Bad requests originally com
------------------------------
Yohji Amano
------------------------------
Original Message:
Sent: Wed July 31, 2024 02:53 AM
From: Przemyslaw Klys
Subject: REST API - POST Body
Hello Yohji,
I tried to do it your way:
import json
.....
body = {
"data": {
"type": "realTimeSearches",
"attributes": {
"query": "HostInfo hostname and Processes name, parentname where Processes cmdline contains font"
}
}
}
inputs.rest_api_body = json.dumps(body)
but it's not working:
ERROR: "'400 Client Error: Bad Request for url: https://api.manage.trellix.com/edr/v2/searches/realtime'"
------------------------------
Przemyslaw Klys
------------------------------
Original Message:
Sent: Wed July 31, 2024 01:57 AM
From: Yohji Amano
Subject: REST API - POST Body
Hello Przemyslaw.
I'm afraid that you may encounter the problem due to confusing 'dict' object with 'str' object.
When passing an input json to the request, it should be a string. (json is a string type object)
So how about coding the following way?
import jsonbody = { "data": { "type": "realTimeSearches", "attributes": { "query": "HostInfo hostname and Processes name, parentname where Processes cmdline contains font" } }}inputs.rest_api_body = json.dumps(body)
json.dumps(<dict>) returns the <str> for <dict> object.
Further you can check the type by encapsulating with type(<object>).
------------------------------
Yohji Amano