IBM QRadar SOAR

IBM QRadar SOAR

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Issue with API result in XML format

    Posted Thu April 04, 2024 05:03 PM
    Edited by Raymond Tam Thu April 04, 2024 05:03 PM

    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 &quot;192.168.0.1&quot;) 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
    ------------------------------



  • 2.  RE: Issue with API result in XML format

    Posted Fri April 05, 2024 10:58 AM

    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
    ------------------------------



  • 3.  RE: Issue with API result in XML format

    Posted Fri April 05, 2024 11:11 AM

    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
    ------------------------------



  • 4.  RE: Issue with API result in XML format

    Posted Sat April 06, 2024 12:35 AM

    Though it's away from soar itself, the following may be  a possible trial.

    - https://developer.bigfix.com/rest-api/relevance_queries.html

    According to the above, To obtain a JSON output, you must pass the 'output=json' key/value pair in your query, as shown in the following examples.

    https://localhost:52311/api/query?relevance=number%20of%20bes%20computers&output=json

    BigFix seems to use XML as default.



    ------------------------------
    Yohji Amano
    ------------------------------



  • 5.  RE: Issue with API result in XML format

    Posted Mon December 30, 2024 07:44 AM

    Hi @Raymond Tam

    Were you able to fix that ? 

    How ?

    Thanks.



    ------------------------------
    mohamad islam hamadieh
    ------------------------------