IBM QRadar SOAR

IBM QRadar

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.  Can we specify sort order in GET REST API

    Posted Wed May 20, 2020 10:01 AM
    Hi, we integrate with Resilient using java REST API. I am trying to get the list of comments of an incident using GET of this REST API:
    https://<host>/rest/orgs/{org_id}/incidents/{incident_id}/comments​


    I would like to get back the list in the order that the latest comment goes first, and the oldest comment goes last, i.e. descending order on comment's create_date. How can I specify that? Can I do that in the URI's query params?

    Thank you very much!



    ------------------------------
    Mei Thom
    ------------------------------


  • 2.  RE: Can we specify sort order in GET REST API
    Best Answer

    Posted Wed May 20, 2020 10:22 AM
    Hey @Mei Thom,

    It might be possible from the GET URL, but I am not sure.

    I can recommend a code-based solution though, it will involve sorting based on the timestamp key value (you'll need to look to see what they key is actually called, and what the format of it is). See here for an example: https://stackoverflow.com/a/35437868

    I have a script that pulls comments for another purpose, here is a snippet:
    notes_json = self.rest_client().get("/incidents/" + str(incident_id) + "/comments?handle_format=names")
    for each in notes_json:
    each["text"] = (str( each["text"].encode("UTF-8", 'replace') ))
    ​​

    ------------------------------
    Jared Fagel
    Cyber Security Analyst I
    Public Utility
    ------------------------------



  • 3.  RE: Can we specify sort order in GET REST API

    Posted Wed May 20, 2020 10:42 AM
    Thanks Jared for the quick response. I need to know the exact param names and format to specify this in Resilient GET comments REST API. Your snippet and the example in stackoverflow link do this programmatically. I think that I'll just get back the list of comments and sort them in the codes then.

    Thanks for your help!

    ------------------------------
    Mei Thom
    ------------------------------



  • 4.  RE: Can we specify sort order in GET REST API

    Posted Thu May 21, 2020 07:58 AM
    Currently it is not possible to specify a sort order when query/get comments.

    Ben

    ------------------------------
    Ben Lurie
    ------------------------------