Owner or Admins
You can make API calls for Synthetics monitors or for monitor labels. These examples show cURL commands.
Access to this feature depends on your subscription level.
To use the REST API for New Relic Synthetics, you must activate API access and generate your Admin User's API key from your account settings. Then you can make standard API calls from the command line.
You must use your Admin User's API key to make Synthetics REST API calls. The account's REST API key will not work.
The Synthetics REST API limits an account's rate of requests to three requests per second. Requests made in excess of this threshold will return a 429 response code.
- Add a label to a monitor
curl -v -X POST -H 'X-Api-Key:Admin_User_Key' -H 'Content-Type: application/json' https://synthetics.newrelic.com/synthetics/api/v4/monitors/monitor_uuid/labels -d 'category:label'
- Get all monitors using a specific label
To view a list of all monitors in New Relic Synthetics that have the same label, replace category:label in the following example with the specific value.
curl -v -H 'X-Api-Key:Admin_User_Key' https://synthetics.newrelic.com/synthetics/api/v4/monitors/labels/category:label
- Delete a label from a monitor
curl -v -X DELETE -H 'X-Api-Key:Admin_User_Key' https://synthetics.newrelic.com/synthetics/api/v4/monitors/monitor_uuid/labels/category:label