Kaseya Community

Make REST API calls with Agent Procedure

  • Is there any way to make a REST call to a web url using an agent procedure with the native commands? Ideally I would want to be able to customize the JSON payload with data from the alert.

  • Interesting idea (feature request) for a procedure step. It doesn't exist yet as far as I know, but we can use cURL in the meantime: curl.haxx.se/download.html

    Example would look something like this: curl -H "content-type: application/json" -H "accept:application/json" -X POST -d "{blah}" "http://someSite?api_key=someKey" -v

  • How would I go about passing alert specific info to wherever I am executing the curl command? It seems like I would have to create an agent proc for each monitor type. For our event log monitors that would be too generic since we have event log monitors that cover warnings, errors and criticals for a variety of sources. I could see the scale and management of getting out of hand really quickly.



    grammer
    [edited by: jimmyc at 10:01 AM (GMT -8) on Dec 1, 2015]
  • Why not use Powershell to use the Invoke-RestMethod command?

    As long as you ensure your endpoints have v3 installed, this to me seems to be the easiest way to go about this. Curl is functional as well, it all depends on which gives you more flexibility to do what you want.

    www.lavinski.me/calling-a-rest-json-api-with-powershell

  • I think the biggest limitation for my use case is that there seems to be no way to pass data from the alert that triggers a procedure into the rest call There's tons of ways I can make rest calls but I'm not seeing a way to dynamically change the request based on data in the alert.

  • These are the variables you will need to pass alert details to your script: help.kaseya.com/.../9020000

  • Perfect that's what I was needing. Thanks!