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.  Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 10:41 AM
    We are migrating incidents from another incident management tool to Resilient. Does anyone have an example of python using the rest API to attach a file to an incident? We have the attachments by incident number in a windows directory structure. This is a one off event for us, so we're not looking for something perfect, just functional.

    ------------------------------
    Thanks,

    Paul Formosa
    ------------------------------


  • 2.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 11:59 AM
      |   view attached
    Hello Paul,

    Thanks for contacting us.

    Here is a sample python script that attach a file to an existing incident, assuming you install the Resilient SDK (v29 or later) already.

    To use it, download the attach_to_inc.txt, and rename it to attach_to_inc.py.  Then run it from an terminal
    python attach-to_inc.py -s <ip address of your resilient server> -u <user email address> -p <user password> -i <incident id> -f <filename> -o <organization> -v <False to skip https certificate validation>

    Please note this is only a sample script. It did not run through any QA.

    Thanks,

    Yongjian Feng

    ------------------------------
    Yongjian Feng
    ------------------------------

    Attachment(s)

    txt
    attach_to_inc.txt   3 KB 1 version


  • 3.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 12:03 PM
    Whoops, I had a typo there. The command line should be
    python attach_to_inc.py -s <ip address of your resilient server> -u <user email address> -p <user password> -i <incident id> -f <filename> -o <organization> -v <False to skip https certificate validation>​​


    ------------------------------
    Yongjian Feng
    ------------------------------



  • 4.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 01:48 PM
    Thanks Yongjian!

    ------------------------------
    PAUL FORMOSA
    ------------------------------



  • 5.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 02:19 PM
    Yongjian, I do have another related question.  First some background, as part of the migration I have mapped the fields from the original incident management tool to the new fields in Resilient and I'm using the incident template function to load the incident information into Resilient (i.e. incident = client.post('/incidents', incident_template)).
    Question: Is there a way to attach the file on the initial creation of the incident incident e.g. a way to add the file that you want to attach as part of the the 'incident template' definition?

    ------------------------------
    PAUL FORMOSA
    ------------------------------



  • 6.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 02:38 PM
    You want a single API call that can create the incident and attach a file at the same time?

    Not sure whether it is possible. But this can be done in two consecutive API calls normally. The return of the first call (to create an incident) is a json dictionary of the created incident. And the "id" field of this dict is the incident index. You can just use that value to attach a file.

    ------------------------------
    Yongjian Feng
    ------------------------------



  • 7.  RE: Does anyone have a python example (rest API) of Attaching files to an Incident?

    Posted Mon February 25, 2019 03:08 PM
    Thanks.  I'll give that a try.

    ------------------------------
    PAUL FORMOSA
    ------------------------------