- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-11-2024 02:10 PM
Hi everyone,
I'm trying to use the 'run_script' API to start the built-in 'Execute_Commands' script on a target machine. I've worked through a few error messages already regarding the command string having black slashes, timeout not being set as integer etc. Now Cortex is telling me I'm missing some parameters from the API call. I have no idea what to change at this point. Any documentation I've found online lists the general parts needed for the API call, without a specific worked example for syntax etc. Below I've posted the JSON and cUrl commands I'm using. Has anyone successfully executed an API call for 'run_script' ? What am I missing?
Thanks,
My CUrl command (supplying JSON for parameters in separate file):
curl -o c:\temp\run_script_results.txt -X POST -H "x-xdr-auth-id:99" -H "Authorization:GsdfdfDFSsdgfs45354dfsfSDFDSfdfsdsfsdfsdfsfssdfsdfsdfdsf" -H "Content-Type:application/json" "https://<fqdn>.xdr.us.paloaltonetworks.com/public_api/v1/scripts/run_script" -d @"c:\temp\json5.txt"
{
"request_data":{
"filters":[
{
"field":"endpoint_id_list",
"operator":"in",
"value":[
"0c14fh74hjhfejwleur3sfj43c2e"
]
}
],
"script_uid":"a0c14fh74hjhfejwleur3sfsdf3333sfgdfw6bf",
"parameters_values":{
"commands_list":"cmd /c type c:\\temp\\WTInv.txt",
"type": "list",
"list_type": "string"},
"script_output_type": "dictionary",
"script_output_dictionary_definitions": ["action_id","status","endpoints_count"], <<< Left this definitions part empty, got same error.
"timeout":600
}
}
Error Message Seen when running cUrl above:
{"reply": {"err_code": 500, "err_msg": "An error occurred while processing XDR public API", "err_extra": "parameters_values contain invalid/missing parameters"}}
06-23-2024 11:29 PM
Hello @cnogawaterfront ,
Are you trying to run the specific command ("commands_list":"cmd /c type c:\\temp\\WTInv.txt")
If yes, then why not you create just one script to run the above command and use it.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!