How to call Synthetic monitor script through API

I am new to newrelic, I am trying to execute a synthetic monitor script through API and also i want to get the result .

How can i do , please guide me

Hi @smani - Welcome to the community. You may find my script template for API synthetic maintenance workaround as a starting point.

1 Like

My interpretation of your question @smani, is that you are looking to trigger your Synthetics monitors to run via the API, and have the monitor results returned in the response of your API call.

If that’s correct, currently that is not possible. There is a feature idea here you can vote on.

2 Likes

Yes exactly I’m looking for that one.

Ok, let me know we can trigger the Synthetics monitors via API ?
Is there any way ?

No @smani There is not yet a ‘Trigger Synthetics Monitor’ API. That is what the feature idea I linked to is asking for.

The workaround there is for you to set up your monitor in and leave it disabled. When you wish to trigger that monitor, you just send an API call to enable the monitor. let it run for a few minutes, and then you’ll need to send another API call to disable that monitor again.

1 Like

Thanks @RyanVeitch. i got it your idea…

1 Like

No worries! Hope it helps :smiley: