Hi Bo,
Thanks, I will take a look at the document and see if there is anything I can try.
For the add text the Note, I tried the following way, but they all have similar issue with the output.
import json
results = playbook.functions.results.rest_response
text_data = results["content"]
json_data = json.loads(text_data.text)
incident.addNote(str(json_data))
# incident.addNote("Sightings for associated event.\n{}".format(results.get("content", {})))
results = playbook.functions.results.find_host_result
if results.get("success"):
incident.addNote("BigFix.\n{}".format(results.get("content", {})))
results = playbook.functions.results.rest_response
incident.addNote(f"{results}")
------------------------------
Ray Tam
------------------------------
Original Message:
Sent: Fri April 05, 2024 10:57 AM
From: Bo Bleckel
Subject: Issue with API result in XML format
Hi Ray -
How are you adding the text to the note? You might want to play around with some of the helper text formatting functions, see here: https://www.ibm.com/docs/en/sqsp/51?topic=scripts-helper-operations
------------------------------
Bo Bleckel
Original Message:
Sent: Thu April 04, 2024 05:03 PM
From: Ray Tam
Subject: Issue with API result in XML format
I am using the Call Rest API function to get a result from BigFix. The result is in xml format. When I output the result to Note, QRadar SOAR converted it to JSON format. The field names are gone and I ended up have many /n and /t in the output. Anyone run into this issue?
Do I need to do something special to handle xml output in QRadar SOAR? Below is the example.
The output looks like this when I run this with Python interpreter:
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
<Query Resource="ids of bes computers whose ( exists ip address whose (it as string contains "192.168.0.1") of it )">
<Result>
<Answer type="integer">12734567</Answer>
</Result>
<Evaluation>
<Time>440.794ms</Time>
<Plurality>Plural</Plurality>
</Evaluation>
</Query>
</BESAPI>
When I write the result to QRadar SOAR Notes, it looks like this. The field name are gone.
'text': '\n\n\t\n\t\t\n\t\t\t1234567\n\t\t\n\t\t\n\t\t\t420.970ms\n\t\t\tPlural\n\t\t\n\t\n\n', 'json': None, 'links': {}}
------------------------------
Ray Tam
------------------------------