1 Reply Latest reply: Sep 11, 2015 10:59 AM by Mattias Wijkström RSS

    Using Sense API to get notification when scheduled task fails

    Göran Sander

      I am looking for a way to hook into the Sense backend and attach a callback/event trigger, so I can get notified when for example certain reload tasks fail.


      Looking at the API, there are a set of "Notification" endpoints, for example "Notification: Add change subscription".

      Sounds very promising, but the docs are somewhat vague wrt what will trigger a notification. From what I understand, this API will trigger when conditions (add/update/delete) are met for certain properties of an entity (or several entities).


      Or should I set the reload task as the entity, then subscribe to a changed event for that entity, and finally look at what the change consists of?


      I think some trial and error is needed here, unless some API wiz can provide guidance...?




        • Re: Using Sense API to get notification when scheduled task fails
          Mattias Wijkström

          One way would be to subscribe to updates to ExecutionResult objects filtering on property status being FinishedFail, as below:


          POST /qrs/notification?name=ExecutionResult&filter=status%20eq%20FinishedFail&changetype=Update


          Note that the body in the request above should be a double quoted URL, e.g. "http://localhost:9876/notifyme". The API documentation incorrectly states that you will get a GUID back. Instead, you will get a change info object back looking something like this:



          ObjectID refers to the ID of the ExecutionResult object. To find out more about the task execution and which task that failed, you will need to query the API for the ExecutionResult object. Then, use the ExecutionResult object's property taskID to fetch the task.

          GET /qrs/executionresult/87c4d045-7841-4b55-8734-defd9a3f55f8
          GET /qrs/reloadtask/65e4a7af-c5fe-49c9-a79e-b5959f2af36b