2 Replies Latest reply on Aug 9, 2019 11:16 AM by Mark Wilkinson

    REST API Check if Specific Discovery Run has Started

    James Yant
      Share This:

      We have an application that pulls data from Discovery via the REST API at intervals throughout the day and would like to be able to conditionally pause this if certain scheduled runs are in the process of scanning.


      Is there a way to programatically check, using the REST API, if a specific scheduled Discovery run is currently scanning?


      What I've seen so far in trying to figure this out is that that the only way to retrieve information on a Discovery run, even if it's a scheduled run, is via the run_id. Can you dynamically retrieve an ID and is this the way we would have to go about telling our application to pause data retrieval?

        • 1. Re: REST API Check if Specific Discovery Run has Started
          Lisa Keeler

          I would probably run a query via the REST/API to check for a currently-running scan with a specific "label".


          A query such as this:


          search DiscoveryRun where __inprogress defined and not _consolidation_source defined and label = "MYSCAN"

          order by starttime desc

          show starttime as 'Start Time', done * 100 / total as 'Percent Complete', scan_level, user, label, key, id(#) as nodeid


          Then, you have the nodeid and the key of the DiscoveryRun.  (maybe you don't need them though... not sure what you are doing).


          If you want to see Scheduled runs:


          search ScanRange where scan_type = 'Scheduled' and label = "MYSCAN" show label as 'Label', (range_strings or provider) as 'Scan Range', scan_level as 'Level', recurrenceDescription(schedule) as 'Date Rules', created_by as 'User', created_time as 'Created'








          2 of 2 people found this helpful
          • 2. Re: REST API Check if Specific Discovery Run has Started
            Mark Wilkinson

            You can use REST endpoint GET /discovery/runs. From the appliance UI click the help menu [the (?) icon at the top] and then REST API, then "show/hide" against "discovery".


            Or directly go to:



            "Implementation Notes

            Get details of all currently processing discovery runs."


            The data returned for each run in progress includes the label.

            1 of 1 people found this helpful