New Relic One already has the capability to unify the tools you use to tag (or label) your services, applications, and monitors. As of July 20, 2020, the New Relic One tagging functionality will replace Synthetics labels and the ability to organize Synthetics and APM tags into groups. You can start migrating to this change now. (As of July 8, 2020, automatic migration begins for existing Synthetics tags.) For more information, including how to migrate your existing tags through the UI or NerdGraph tagging API, see New Relic's Explorers Hub post.
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
- Dissociate 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