How to set timeout for Scripted API monitor type

Hi Support,

I need to know how to add timeout for Scripted API type monitors’s script.
I used below sample and it is not working.

$http.get('http://XXXXX.com', {timeout: 1500}, function(err) {
    //logic
});

Thanks

Hi, @dhanushka.perumbuli: The $http object is an instance of the Node request module. Looking at the documentation, it appears that you may pass either a URL or an options object to the get() method, but not both. If you want to specify a timeout, you should pass an options object:

$http.get({
  url: 'http://XXXXX.com',
  timeout: 1500
})
1 Like