Skip to content

Instantly share code, notes, and snippets.

@ianfixes ianfixes/README.md
Last active Apr 3, 2020

Embed
What would you like to do?
New Relic Swagger 2.0 (OpenAPI spec) for generating clients and documentation

What this Gist is

Swagger (OpenAPI) 2.0 spec to generate New Relic clients and documentation, in response to https://discuss.newrelic.com/t/api-declaration-swagger-for-example/35365

Contributed by Ian Katz ikatz@drizly.com with permission from Drizly.

Example usage

See (& Validate) Documentation Online

  1. Paste the text from newrelic_spec_swagger_2.yml (below) into http://editor.swagger.io/
  2. There is no step 2

Generate and run a Ruby client

You need Swagger generator 2.x, I'm using the brew install swagger-codegen@2 version on OSX.

$ /usr/local/opt/swagger-codegen\@2/bin/swagger-codegen generate -l ruby -o gem -c ruby.json -i newrelic_spec_swagger_2.yml

With that done, you can test it via irb.
You'll have to go to https://rpm.newrelic.com/accounts/<YOUR ACCOUNT ID>/integrations?page=api_keys and generate an API key for yourself.

$ bundle exec irb -r ruby_irb_init.rb

with ruby_irb_init.rb being:

require 'new_relic'

NewRelic.configure { |c| c.api_key['X-Api-Key'] = "YOUR API KEY" }
nr = NewRelic::DefaultApi.new

How I Made This File

Get the current API docs

# make directory and pull down existing NewRelic docs
$ mkdir -p fake_web/v2/definitions
$ cd fake_web/v2

# get the master API spec from its URL
$ wget https://api.newrelic.com/v2/definitions.json
$ cd definitions

# get the rest of the JSON files
#  - pull out all remote URLs from the master api document
#  - convert /v2/defintions/foo.{format} to foo.json
#  - get foo.json if it doesn't exist locally
$ cat ../definitions.json | \
  jq ".apis[].path" -r    | \
  awk -F"/" '{print $4}'  | \
  awk -F. '{print "test -f " $1 ".json || curl https://api.newrelic.com/v2/definitions/" $1 ".json | jq > " $1 ".json"}' | \
  sh

Convert the offending hash types to object

$ vi `ag -l '"type":"hash"'`

Then type :argdo %s/"type":"hash"/"type":"object"/g|update and hit enter. Then hit enter and :q enter again.

Serve up the pages locally for testing

Edit definitions.json and change https://api.newrelic.com to http://localhost then fire up a webserver locally with fake_web as the root directory. Do testing and whatever. It doesn't help though.

Manually assemble the spec

# https://stackoverflow.com/a/36218044
$ jq -s 'reduce .[] as $item ({}; . * $item)' fake_web/v2/definitions/*.json > full_spec.json

This does everything except the paths, which are an array. Fix that by running

$ jq -s 'reduce .[] as $item ({}; .apis += $item.apis) | .apis' fake_web/v2/definitions/*.json | pbcopy

and copying the result into the apis array of full_spec.json

Fix more errors in the spec

Need to add a missing model:

    "IJKTermsType": {
      "properties": {
        "duration":      { "type": "string"},
        "operator":      { "type": "string"},
        "priority":      { "type": "string"},
        "threshold":     { "type": "string"},
        "time_function": { "type": "string"}
      }
    },
  • Need to change all instances of $refs that point to this structure (beginning with duration and ending with time_function) to be "$ref": "IJKTermsType" instead.
  • Need to change all instances of "dataType": "Time" to "dataType": "string", "format": "date-time"
  • Need to change all instances of "type": "time" to "type": "string", "format": "date-time"

Do initial conversion

$ node_modules/.bin/api-spec-converter -f swagger_1 -t swagger_2 -s json full_spec.json > newrelic_swagger_2.json

Manually iterate on the result

  • Paste the entire thing into http://editor.swagger.io/ to convert it to yaml.
  • Copy the YAML to a file, then cat newrelic_spec_swagger_2.yml | grep -v operationId | pbcopy
  • Copy the YAML back into that file.
  • Now massage the result in the online Swagger editor such that the "Equivalent paths" are collapsed to a single path.
  • Add a security section at the top
securityDefinitions:
   # X-Api-Key: abcdef12345
   APIKeyHeader:
     type: apiKey
     in: header
     name: X-Api-Key
security:
  - APIKeyHeader: []     # use the same name as under securityDefinitions
  • Find and replace all /v2/ with /, then change the basepath: basePath: /v2/
swagger: '2.0'
info:
title: api.newrelic.com
version: v2
host: api.newrelic.com
basePath: /v2/
schemes:
- https
securityDefinitions:
# X-Api-Key: abcdef12345
APIKeyHeader:
type: apiKey
in: header
name: X-Api-Key
security:
- APIKeyHeader: [] # use the same name as under securityDefinitions
paths:
/alerts_channels.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ChannelResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint works with new Alerts on alerts.newrelic.com.</p>
<p>It returns a list of the channels associated with your New Relic account.</p>
<p>Note: See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#channels-list">listing notification channels</a>.</p>
summary: List
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: channel schema
in: body
name: channel
required: true
schema:
$ref: '#/definitions/Channel'
- description: Policy IDs to associate with channel
in: query
items:
type: string
name: policy_ids
required: false
type: array
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ChannelResponse'
description: |+
<p>This API endpoint works with new Alerts on alerts.newrelic.com.</p>
<p>It creates a channel associated with your New Relic account.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#channels-create">creating notification channels</a>.</p>
<p>Channel type configuration options:</p>
<ul>
<li>
<p>Email</p>
<p>{</p>
<pre><code>"recipients" : "test@google.com",
"include_json_attachment" : true
</code></pre>
<p>}</p>
</li>
<li>
<p>HipChat</p>
<p>{</p>
<pre><code>"auth_token": "abc123",
"room_id": "google.com"
</code></pre>
<p>}</p>
</li>
<li>
<p>OpsGenie</p>
<p>{</p>
<pre><code>"api_key": "abc123",
"teams": "team1",
"tags": "tag1",
"recipients": "me@me.com"
</code></pre>
<p>}</p>
</li>
<li>
<p>Slack</p>
<p>{</p>
<pre><code>"url": "http://test.com",
"channel": "channel1"
</code></pre>
<p>}</p>
</li>
<li>
<p>Campfire</p>
<p>{</p>
<pre><code>"subdomain": "mysubdomain",
"token": "123abc",
"room": "room1"
</code></pre>
<p>}</p>
</li>
<li>
<p>Victorops</p>
<p>{</p>
<pre><code>"key": "mykey",
"route_key": "theroute"
</code></pre>
<p>}</p>
</li>
<li>
<p>PagerDuty</p>
<p>{</p>
<pre><code>"service_key": "myservicekey"
</code></pre>
<p>}</p>
</li>
<li>
<p>Webhook (json)</p>
<p>{</p>
<pre><code>"base_url": "http://test.com",
"auth_username": "username",
"auth_password": "password",
"payload_type": "application/json",
"payload": {
"account_id": "$ACCOUNT_ID",
"account_name": "$ACCOUNT_NAME",
"condition_id": "$CONDITION_ID",
"condition_name": "$CONDITION_NAME",
"current_state": "$EVENT_STATE",
"details": "$EVENT_DETAILS",
"event_type": "$EVENT_TYPE",
"incident_acknowledge_url": "$INCIDENT_ACKNOWLEDGE_URL",
"incident_id": "$INCIDENT_ID",
"incident_url": "$INCIDENT_URL",
"owner": "$EVENT_OWNER",
"policy_name": "$POLICY_NAME",
"policy_url": "$POLICY_URL",
"runbook_url": "$RUNBOOK_URL",
"severity": "$SEVERITY",
"targets": "$TARGETS",
"timestamp": "$TIMESTAMP",
"violation_chart_url": "$VIOLATION_CHART_URL"
},
"headers": {"header1": "test", "header2": "test"}
</code></pre>
<p>}</p>
</li>
<li>
<p>Webhook (x-www-form-urlencoded)</p>
<p>{</p>
<pre><code>"base_url": "http://test.com",
"auth_username": "username",
"auth_password": "password",
"payload_type": "application/x-www-form-urlencoded",
"payload": {
"account_id": "$ACCOUNT_ID",
"account_name": "$ACCOUNT_NAME",
"condition_id": "$CONDITION_ID",
"condition_name": "$CONDITION_NAME",
"current_state": "$EVENT_STATE",
"details": "$EVENT_DETAILS",
"event_type": "$EVENT_TYPE",
"incident_acknowledge_url": "$INCIDENT_ACKNOWLEDGE_URL",
"incident_id": "$INCIDENT_ID",
"incident_url": "$INCIDENT_URL",
"owner": "$EVENT_OWNER",
"policy_name": "$POLICY_NAME",
"policy_url": "$POLICY_URL",
"runbook_url": "$RUNBOOK_URL",
"severity": "$SEVERITY",
"targets": "$TARGETS",
"timestamp": "$TIMESTAMP",
"violation_chart_url": "$VIOLATION_CHART_URL"
},
"headers": {"header1": "test", "header2": "test"}
</code></pre>
<p>}</p>
</li>
</ul>
summary: Create
'/alerts_channels/{channel_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Channel ID
in: path
name: channel_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ChannelResponse'
description: |+
<p>This API endpoint deletes Alerts notification channels.</p>
<p>Note: <code>User</code> notification channels cannot be deleted.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#channels-delete">deleting notification channels</a>.</p>
summary: Delete
/alerts_conditions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: query
name: policy_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to list APM Application and Key Transaction, Browser and Mobile application metric conditions for your alert policies.</p>
<p>Note: <strong>Conditions for web transaction percentiles, or conditions targeting labels (dynamic targeting), are not available.</strong></p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>.</p>
summary: List
'/alerts_conditions/policies/{policy_id}.json':
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: path
name: policy_id
required: true
type: integer
- description: Condition schema
in: body
name: condition
required: true
schema:
$ref: '#/definitions/Condition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: "<p>This API endpoint allows you to create APM Application and Key Transaction, Browser and Mobile application metric conditions for your alert policies.</p>\n\n<p><strong>Conditions for web transaction percentiles, or conditions targeting labels (dynamic targeting), are not available.</strong></p>\n\n<p>Note: <a href=\"https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key\">Admin User’s API Key</a> is required.</p>\n\n<p>See our documentation for a discussion on <a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#conditions-create\" target=\"_blank\">creating conditions for policies</a>.\n<br /></p>\n\n<p>All fields are required except for “runbook_url”, “enabled” (defaults to false), “user_defined”.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#type\" target=\"_blank\">type</a>: apm_app_metric, apm_kt_metric, servers_metric, browser_metric, mobile_metric.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#name\" target=\"_blank\">name</a>: A title for your condition.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#enabled\" target=\"_blank\">enabled</a>: The status of your condition (optional).</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#entities\" target=\"_blank\">entities</a>: An array of instance IDs associated with your condition.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#metric\" target=\"_blank\">metric</a>: The metric field accepts parameters based on the condition <b>type</b> selected as follows:</p>\n\n<p>\_\_When <b>apm_app_metric</b>: apdex, error_percentage, response_time_web, response_time_background, throughput_web, throughput_background, user_defined.</p>\n\n<p>\_\_When <b>apm_kt_metric</b>: apdex, error_percentage, error_count, response_time, throughput.</p>\n\n<p>\_\_When <b>servers_metric</b>: cpu_percentage, disk_io_percentage, memory_percentage, fullest_disk_percentage, load_average_one_minute, user_defined.</p>\n\n<p>\_\_When <b>browser_metric</b>: end_user_apdex, total_page_load, page_rendering, web_application, network, dom_processing, request_queuing, ajax_response_time, page_views_with_js_errors, page_view_throughput, ajax_throughput, user_defined.</p>\n\n<p>\_\_When <b>mobile_metric</b>: database, images, json, network, view_loading, network_error_percentage, status_error_percentage, mobile_crash_rate, user_defined.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/alerts-conditions-api-field-names#condition-scope\">condition_scope</a>: Set to either <code>instance</code> to target a Java application instance or <code>application</code> for a Java app.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/alerts-conditions-api-field-names#violation_close_timer\">violation_close_timer</a> (in hours): 1, 2, 4, 8, 12, 24. Duration after which instance-based (including JVM health metric) violations will automatically close.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#runbook_url\" target=\"_blank\">runbook_url</a>: Runbook URL to display in notifications (optional).</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_duration\" target=\"_blank\">terms[duration]</a> (in minutes): 5, 10, 15, 30, 60, 120.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_operator\" target=\"_blank\">terms[operator]</a>: above, below, equal.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_priority\" target=\"_blank\">terms[priority]</a>: critical, warning.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_threshold\" target=\"_blank\">terms[threshold]</a>: Must be 0 or greater.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_time_function\" target=\"_blank\">terms[time_function]</a>: all, any.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#user_defined_metric\" target=\"_blank\">user_defined[metric]</a>: A custom metric to be evaluated.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#user_defined_value_function\" target=\"_blank\">user_defined[value_function]</a>: average, min, max, total, sample_size.</p>\n\n"
summary: Create
'/alerts_conditions/{condition_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID
in: path
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: |
<p>This API endpoint allows you to delete APM Application and Key Transaction, Browser and Mobile application metric conditions for your alert policies.</p>
<p><strong>Conditions for web transaction percentiles, or conditions targeting labels (dynamic targeting), are not available.</strong></p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#conditions-delete" target="_blank">deleting conditions</a>.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID to update
in: path
name: condition_id
required: true
type: integer
- description: Condition schema
in: body
name: condition
required: true
schema:
$ref: '#/definitions/Condition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: |+
<p>This API endpoint allows you to update APM Application and Key Transaction, Browser and Mobile application metric conditions for your alert policies.</p>
<p><strong>Conditions for web transaction percentiles, or conditions targeting labels (dynamic targeting), are not available.</strong></p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See Alerts Conditions &gt; Create for an explanation of the field values or the online
documentation on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#conditions-update" target="_blank">updating conditions for policies</a>.</p>
summary: Update
'/alerts_entity_conditions/{entity_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Entity id to remove
in: path
name: entity_id
required: true
type: integer
- description: Entity Type
in: query
name: entity_type
required: true
type: string
- description: Alerts condition ID
in: query
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: |
<p>This API endpoint allows you to disassociate an entity with a specified Alerts condition.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>Entity type options (Synthetics is not yet supported):</p>
<pre><code>BrowserApplication
Application
MobileApplication
Server
KeyTransaction
Plugin
</code></pre>
summary: Remove
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Entity ID
in: path
name: entity_id
required: true
type: integer
- description: Entity Type
in: query
name: entity_type
required: true
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: |
<p>This API endpoint allows you to list the Alerts conditions an entity is part of.</p>
<p>Entity type options (Synthetics is not yet supported):</p>
<pre><code>BrowserApplication
Application
MobileApplication
Server
KeyTransaction
Plugin
</code></pre>
summary: List
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Entity id to add
in: path
name: entity_id
required: true
type: integer
- description: Entity Type
in: query
name: entity_type
required: true
type: string
- description: Alerts condition ID
in: query
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ConditionResponse'
description: |
<p>This API endpoint allows you to add an entity to a specified Alerts condition.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.
<br />
Entity type options (Synthetics is not yet supported):</p>
<pre><code>BrowserApplication
Application
MobileApplication
Server
KeyTransaction
Plugin
</code></pre>
summary: Add
/alerts_events.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Filter by New Relic product
in: query
name: 'filter[product]'
required: false
type: string
- description: Filter by entity type
in: query
name: 'filter[entity_type]'
required: false
type: string
- description: Filter by entity group ID
in: query
name: 'filter[entity_group_id]'
required: false
type: integer
- description: Filter by entity ID
in: query
name: 'filter[entity_id]'
required: false
type: integer
- description: Filter by event type
in: query
name: 'filter[event_type]'
required: false
type: string
- description: Filter by incident id
in: query
name: 'filter[incident_id]'
required: false
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/RecentEventResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to list the alert events for your account.</p>
<p>Alerts events can be filter by product, target type, group ID, instance ID, and event type.</p>
<p>The options for products are: <b>APM</b>, <b>BROWSER</b>, <b>MOBILE</b>, <b>SERVERS</b>, <b>PLUGINS</b>, <b>SYNTHETICS</b>, and <b>ALERTS</b>.</p>
<p>The options for entity type are: <b>Application</b>, <b>Server</b>, <b>KeyTransaction</b>, <b>Plugin</b>, <b>MobileApplication</b>, <b>BrowserApplication</b>, and <b>Monitor</b>.</p>
<p>The options for event type are: <b>NOTIFICATION</b>, <b>DEPLOYMENT</b>, <b>VIOLATION_OPEN</b>, <b>VIOLATION_CLOSE</b>, <b>VIOLATION</b>, and <b>INSTRUMENTATION</b>.</p>
<p>The group ID option is normally the same as the entity ID (e.g. an Application group ID and entity ID will be the same), however PLUGINS have a group ID representing the PLUGIN itself, and entity IDs for all instances of that PLUGIN type.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>.</p>
summary: List
/alerts_external_service_conditions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: query
name: policy_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ExternalServiceConditionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to list the external service conditions for your alert policy.</p>
<p>See our documentation for a discussion on
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>.</p>
summary: List
'/alerts_external_service_conditions/policies/{policy_id}.json':
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: path
name: policy_id
required: true
type: integer
- description: Condition schema
in: body
name: external_service_condition
required: true
schema:
$ref: '#/definitions/ExternalServiceCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ExternalServiceConditionResponse'
description: "<p>This API endpoint allows you to create external service conditions for your alert policies.</p>\n\n<p>Note: <a href=\"https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key\">Admin User’s API Key</a> is required.</p>\n\n<p>See our documentation for a discussion on <a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#ext-conditions-create\" target=\"_blank\">creating conditions for external services</a>.</p>\n\n<p>All fields are required except for “runbook_url”, “enabled” (defaults to false).</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#type\" target=\"_blank\">type</a>: apm_external_service, mobile_external_service.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#name\" target=\"_blank\">name</a>: A title for your condition.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#enabled\" target=\"_blank\">enabled</a>: The status of your condition (optional).</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#entities\" target=\"_blank\">entities</a>: An array of instance IDs associated with your condition.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#external_service_url\" target=\"_blank\">external_service_url</a>: The URL of the external service. Must not include protocol (“example.com”, not “https://example.com”)</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#metric\" target=\"_blank\">metric</a>: The metric field accepts parameters based on the condition <b>type</b> selected as follows:</p>\n\n<p>\_\_When <b>apm_external_service</b>: response_time_average, response_time_minimum, response_time_maximum, throughput.</p>\n\n<p>\_\_When <b>mobile_external_service</b>: response_time_average, response_time_minimum, response_time_maximum, throughput, network_failure_percentage, http_status_error_percentage.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#runbook_url\" target=\"_blank\">runbook_url</a>: Runbook URL to display in notifications (optional).</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_duration\" target=\"_blank\">terms[duration]</a> (in minutes): 5, 10, 15, 30, 60, 120.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_operator\" target=\"_blank\">terms[operator]</a>: above, below, equal.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_priority\" target=\"_blank\">terms[priority]</a>: critical, warning.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_threshold\" target=\"_blank\">terms[threshold]</a>: Must be 0 or greater.</p>\n\n<p><a href=\"https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_time_function\" target=\"_blank\">terms[time_function]</a>: all, any.</p>\n\n"
summary: Create
'/alerts_external_service_conditions/{condition_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID
in: path
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ExternalServiceConditionResponse'
description: |+
<p>This API endpoint allows you to delete external service conditions associated with your alert policy.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#ext-conditions-delete" target="_blank">deleting External services conditions</a>.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID to update
in: path
name: condition_id
required: true
type: integer
- description: Condition schema
in: body
name: external_service_condition
required: true
schema:
$ref: '#/definitions/ExternalServiceCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ExternalServiceConditionResponse'
description: |
<p>This API endpoint allows you to update external service conditions for your alert policies.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See Alerts External Service Conditions &gt; Create for an explanation of the field values used in this command or the online documentation on
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#ext-conditions-update" target="_blank">updating conditions for external services</a>.</p>
summary: Update
/alerts_incidents.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Pagination index
in: query
name: page
required: false
type: integer
- description: Filter by open incidents
in: query
name: only_open
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/IncidentResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint returns a list of the Incidents associated with your New Relic account.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#incidents" target="_blank">listing incidents</a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">output pagination</a>.</p>
summary: List
/alerts_nrql_conditions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: query
name: policy_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/NrqlConditionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to list the NRQL conditions for your Alerts policy.</p>
<p>Note: <strong>NRQL Baseline conditions are not available.</strong></p>
summary: List
'/alerts_nrql_conditions/policies/{policy_id}.json':
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: path
name: policy_id
required: true
type: integer
- description: Condition schema
in: body
name: nrql_condition
required: true
schema:
$ref: '#/definitions/NrqlCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/NrqlConditionResponse'
description: |
<p>This API endpoint allows you to create NRQL conditions for your Alerts policy.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#conditions-create" target="_blank">creating conditions for policies</a>.</p>
summary: Create
'/alerts_nrql_conditions/{condition_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID
in: path
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/NrqlConditionResponse'
description: |
<p>This API endpoint allows you to delete NRQL conditions for your Alerts policy.</p>
<p><strong>NRQL Baseline conditions are not available.</strong></p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID to update
in: path
name: condition_id
required: true
type: integer
- description: Condition schema
in: body
name: nrql_condition
required: true
schema:
$ref: '#/definitions/NrqlCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/NrqlConditionResponse'
description: |
<p>This API endpoint allows you to update NRQL conditions for your Alerts policy.</p>
<p><strong>NRQL Baseline conditions are not available.</strong></p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See Alerts NRQL Conditions &gt; Create for an explanation of the field values.</p>
summary: Update
/alerts_plugins_conditions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: query
name: policy_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PluginsConditionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to list the Plugins conditions for your alert policy.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>.</p>
summary: List
'/alerts_plugins_conditions/policies/{policy_id}.json':
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: path
name: policy_id
required: true
type: integer
- description: Condition schema
in: body
name: plugins_condition
required: true
schema:
$ref: '#/definitions/PluginsCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PluginsConditionResponse'
description: |
<p>This API endpoint allows you to create Plugins conditions for your alert policies.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#plugins-conditions-create" target="_blank">creating conditions for plugins</a>.</p>
<p>All fields are required except for “runbook_url”, “enabled” (defaults to false).</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#name" target="_blank">name</a>: A title for your condition.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#enabled" target="_blank">enabled</a>: The status of your condition (optional).</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#entities" target="_blank">entities</a>: An array of instance IDs associated with your condition.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#metric_description" target="_blank">metric_description</a>: A title for the metric to display in notifications.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#metric" target="_blank">metric</a>: The metric to evaluate on.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#value_function" target="_blank">value_function</a>: min, max, average, sample_size, total, percent</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#runbook_url" target="_blank">runbook_url</a>: Runbook URL to display in notifications (optional).</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_duration" target="_blank">terms[duration]</a> (in minutes): 5, 10, 15, 30, 60, 120.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_operator" target="_blank">terms[operator]</a>: above, below, equal.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_priority" target="_blank">terms[priority]</a>: critical, warning.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_threshold" target="_blank">terms[threshold]</a>: Must be 0 or greater.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#terms_time_function" target="_blank">terms[time_function]</a>: all, any.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#plugin_id" target="_blank">plugin[id]</a>: The ID of the plugin.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#plugin_guid" target="_blank">plugin[guid]</a>: The GUID of the plugin.</p>
summary: Create
'/alerts_plugins_conditions/{condition_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID
in: path
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PluginsConditionResponse'
description: |
<p>This API endpoint allows you to delete Plugins conditions associated with your alert policy.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#plugins-conditions-delete" target="_blank">deleting Plugins conditions</a>.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID to update
in: path
name: condition_id
required: true
type: integer
- description: Condition schema
in: body
name: plugins_condition
required: true
schema:
$ref: '#/definitions/PluginsCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PluginsConditionResponse'
description: |+
<p>This API endpoint allows you to update Plugins conditions for your alert policies.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See Alerts Plugins Conditions &gt; Create for an explanation of the field values ued in this command or the online document on
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#plugins-conditions-update" target="_blank">updating conditions for plugins</a>.</p>
summary: Update
/alerts_policies.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Name (must be exact match)
in: query
name: 'filter[name]'
required: false
type: string
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PolicyResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint works with new Alerts on alerts.newrelic.com.</p>
<p>This API endpoint returns a list of the alert policies associated with your New Relic account.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>.</p>
summary: List
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Policy Schema
in: body
name: policy
required: true
schema:
$ref: '#/definitions/Policy'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PolicyResponse'
description: |+
<p>This API endpoint works with new Alerts on alerts.newrelic.com.</p>
<p>This Alerts API endpoint creates a policy associated with your New Relic account.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>Rollup stategy options:</p>
<ul>
<li>PER_POLICY</li>
<li>PER_CONDITION</li>
<li>PER_CONDITION_AND_TARGET</li>
</ul>
<p>See our documentation for a discussion on using the REST API for
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#policies-create" target="_blank">creating new policies</a>.</p>
summary: Create
'/alerts_policies/{policy_id}.json':
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Policy ID
in: path
name: policy_id
required: true
type: integer
- description: Policy Schema
in: body
name: policy
required: true
schema:
$ref: '#/definitions/Policy'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PolicyResponse'
description: |+
<p>This API endpoint updates Alerts policies associated with your New Relic account.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on using the REST API for
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#policies-update" target="_blank">updating policies</a>.</p>
summary: Update
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Policy ID
in: path
name: policy_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PolicyResponse'
description: |+
<p>This API endpoint deletes Alerts policies associated with your New Relic account.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on using the REST API for
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#policies-delete" target="_blank">deleting policies</a>.</p>
summary: Delete
/alerts_policy_channels.json:
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Policy ID
in: query
name: policy_id
required: true
type: integer
- description: Channel ID
in: query
name: channel_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ChannelResponse'
description: |
<p>This API endpoint deletes Alerts policy/channel associations.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#policy-channels-delete">deleting notification channels with policies</a>.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Policy ID
in: query
name: policy_id
required: true
type: integer
- description: Channel IDs
in: query
items:
type: string
name: channel_ids
required: true
type: array
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/PolicyChannelsResponse'
description: |
<p>This API endpoint updates policy/channel associations.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#policy-channels-update">updating notification channels with policies</a>.</p>
summary: Update
/alerts_synthetics_conditions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: query
name: policy_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/SyntheticsConditionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint allows you to list the Synthetics conditions for your alert policy.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#synthetics-conditions-list" target="_blank">listing Synthetic conditions</a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>.</p>
summary: List
'/alerts_synthetics_conditions/policies/{policy_id}.json':
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts policy ID
in: path
name: policy_id
required: true
type: integer
- description: Condition schema
in: body
name: synthetics_condition
required: true
schema:
$ref: '#/definitions/SyntheticsCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/SyntheticsConditionResponse'
description: |
<p>This API endpoint allows you to create Synthetics conditions for your alert policies.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#synthetics-conditions-create" target="_blank">creating Synthetic conditions</a>.</p>
<p>All fields are required except for “runbook_url”, “enabled” (defaults to false).</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#name" target="_blank">name</a>: A title for your condition.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#monitor_id" target="_blank">monitor_id</a>: The GUID of the Synthetics monitor to alert on.</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#runbook_url" target="_blank">runbook_url</a>: Runbook URL to display in notifications (optional).</p>
<p><a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/alerts-conditions-api-field-names#enabled" target="_blank">enabled</a>: The status of your condition (optional).</p>
summary: Create
'/alerts_synthetics_conditions/{condition_id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID
in: path
name: condition_id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/SyntheticsConditionResponse'
description: |+
<p>This API endpoint allows you to delete Synthetics conditions associated with your alert policy.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#synthetics-conditions-delete" target="_blank">deleting Synthetic conditions</a>.</p>
summary: Delete
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Alerts condition ID to update
in: path
name: condition_id
required: true
type: integer
- description: Condition schema
in: body
name: synthetics_condition
required: true
schema:
$ref: '#/definitions/SyntheticsCondition'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/SyntheticsConditionResponse'
description: |
<p>This API endpoint allows you to update Synthetics conditions for your alert policies.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/rest-api-alerts/rest-api-calls-new-relic-alerts#synthetics-conditions-update" target="_blank">updating Synthetic conditions</a>.</p>
<p>See Alerts Synthetics Conditions &gt; Create for an explanation of the field values used in this command.</p>
summary: Update
/alerts_violations.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Pagination index
in: query
name: page
required: false
type: integer
- description: Retrieve violations created after this time
format: date-time
in: query
name: start_date
required: false
type: string
- description: Retrieve violations created before this time
format: date-time
in: query
name: end_date
required: false
type: string
- description: Filter by open violations
in: query
name: only_open
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ViolationResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint works with new Alerts on alerts.newrelic.com.</p>
<p>It returns a list of the violations associated with your New Relic account.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>.</p>
summary: List
/applications.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Filter by application name
in: query
name: 'filter[name]'
required: false
type: string
- description: Filter by application host
in: query
name: 'filter[host]'
required: false
type: string
- description: Filter by application ids
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Filter by application language
in: query
name: 'filter[language]'
required: false
type: string
- description: Exclude links section from the response
in: query
name: exclude_links
required: false
type: boolean
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint returns a <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">paginated</a>
list of the Applications associated with your New Relic account. The time range for summary data is the last 3-4 minutes.</p>
<p>Applications can be filtered by their name, hosts, the list of application IDs or the application language as
reported by the agents.</p>
<p>See our documentation for a discussion and examples of
using <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/list-application-specific-server-host-instance-ids" target="_blank"> filters </a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: List
'/applications/{application_id}/deployments.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/DeploymentResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint returns a paginated list of the deployments associated with a given application.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output">output pagination</a>.</p>
summary: List
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Deployment schema
in: body
name: deployment
required: true
schema:
$ref: '#/definitions/Deployment'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/DeploymentResponse'
description: "<p>This API endpoint creates a deployment record for a given application.\nDeployment records are created with the following attributes:</p>\n\n<p>Required:<br />\n\_\_- Application ID<br />\n\_\_- Revision, such as a git SHA<br /></p>\n\n<p>Optional:<br />\n\_\_- Changelog <br />\n\_\_- Description <br />\n\_\_- User posting the deployment<br /></p>\n\n<p>Note that the time of your deployment will be recorded as the current time in UTC.</p>\n"
summary: Create
'/applications/{application_id}/deployments/{id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Deployment ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/DeploymentResponse'
description: |+
<p>This API endpoint deletes the specified deployment record.</p>
<p>Note: <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key">Admin User’s API Key</a> is required.</p>
summary: Delete
'/applications/{application_id}/hosts.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Filter by server hostname
in: query
name: 'filter[hostname]'
required: false
type: string
- description: Filter by application host ids
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationHostResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint returns a <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
paginated</a> list of hosts associated with the given application. The time range for summary data is the last 3-4 minutes.</p>
<p>Application hosts can be filtered by hostname, or the list of application host IDs.</p>
<p>See our documentation for a discussion and examples of
using <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/list-application-specific-server-host-instance-ids" target="_blank"> filters </a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: List
'/applications/{application_id}/hosts/{host_id}/metrics.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application Host ID
in: path
name: host_id
required: true
type: integer
- description: Filter metrics by name
in: query
name: name
required: false
type: string
- description: Pagination index (will be deprecated)
in: query
name: page
required: false
type: integer
- description: Cursor for next page (replacing page param)
in: query
name: cursor
required: false
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricListResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>Return a list of known metrics and their value names for the given resource.</p>
<p>See our documentation for a discussion
on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>
and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Names
'/applications/{application_id}/hosts/{host_id}/metrics/data.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application Host ID
in: path
name: host_id
required: true
type: integer
- description: Retrieve specific metrics by name
in: query
items:
type: string
name: names
required: true
type: array
- description: Retrieve specific metric values
in: query
items:
type: string
name: values
required: false
type: array
- description: Retrieve metrics after this time
format: date-time
in: query
name: from
required: false
type: string
- description: Retrieve metrics before this time
format: date-time
in: query
name: to
required: false
type: string
- description: Period of timeslices in seconds
in: query
name: period
required: false
type: integer
- description: Summarize the data
in: query
name: summarize
required: false
type: boolean
- description: Return unformatted raw values
in: query
name: raw
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricDataResponse'
description: |+
<p>This API endpoint returns a list of values for each of the requested metrics. The list of available metrics
can be returned using the Metric Name API endpoint.</p>
<p>Metric data can be filtered by a number of parameters, including multiple names and values, and by time range.
Metric names and values will be matched intelligently in the background.</p>
<p>You can also retrieve a summarized data point across the entire time range selected by using the summarize
parameter.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>, <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/extracting-metric-data" target="_blank"> time range</a>
related considerations, and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Data
'/applications/{application_id}/hosts/{id}.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application host ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationHostResponse'
description: |+
<p>This API endpoint returns a single application host, identified by ID. The time range for summary data is the last 3-4 minutes.</p>
<p>See our documentation for a discussion of
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: Show
'/applications/{application_id}/instances.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Filter by server hostname
in: query
name: 'filter[hostname]'
required: false
type: string
- description: Filter by application instance ids
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationInstanceResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint returns a <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
paginated</a> list of instances associated with the given application. The time range for summary data is the last 3-4 minutes.</p>
<p>Application instances can be filtered by hostname, or the list of application instance IDs.</p>
<p>See our documentation for a discussion and examples of
using <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/list-application-specific-server-host-instance-ids" target="_blank"> filters </a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: List
'/applications/{application_id}/instances/{id}.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application instance ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationInstanceResponse'
description: |+
<p>This API endpoint returns a single application instance, identified by ID. The time range for summary data is the last 3-4 minutes.</p>
<p>See our documentation for a discussion of
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: Show
'/applications/{application_id}/instances/{instance_id}/metrics.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application Instance ID
in: path
name: instance_id
required: true
type: integer
- description: Filter metrics by name
in: query
name: name
required: false
type: string
- description: Pagination index (will be deprecated)
in: query
name: page
required: false
type: integer
- description: Cursor for next page (replacing page param)
in: query
name: cursor
required: false
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricParserResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>Return a list of known metrics and their value names for the given resource.</p>
<p>See our documentation for a discussion
on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>
and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Names
'/applications/{application_id}/instances/{instance_id}/metrics/data.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Application Instance ID
in: path
name: instance_id
required: true
type: integer
- description: Retrieve specific metrics by name
in: query
items:
type: string
name: names
required: true
type: array
- description: Retrieve specific metric values
in: query
items:
type: string
name: values
required: false
type: array
- description: Retrieve metrics after this time
format: date-time
in: query
name: from
required: false
type: string
- description: Retrieve metrics before this time
format: date-time
in: query
name: to
required: false
type: string
- description: Period of timeslices in seconds
in: query
name: period
required: false
type: integer
- description: Summarize the data
in: query
name: summarize
required: false
type: boolean
- description: Return unformatted raw values
in: query
name: raw
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricDataResponse'
description: |+
<p>This API endpoint returns a list of values for each of the requested metrics. The list of available metrics
can be returned using the Metric Name API endpoint.</p>
<p>Metric data can be filtered by a number of parameters, including multiple names and values, and by time range.
Metric names and values will be matched intelligently in the background.</p>
<p>You can also retrieve a summarized data point across the entire time range selected by using the summarize
parameter.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>, <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/extracting-metric-data" target="_blank"> time range</a>
related considerations, and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Data
'/applications/{application_id}/metrics.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Filter metrics by name
in: query
name: name
required: false
type: string
- description: Pagination index (will be deprecated)
in: query
name: page
required: false
type: integer
- description: Cursor for next page (replacing page param)
in: query
name: cursor
required: false
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricParserResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>Return a list of known metrics and their value names for the given resource.</p>
<p>See our documentation for a discussion
on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>
and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Names
'/applications/{application_id}/metrics/data.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: application_id
required: true
type: integer
- description: Retrieve specific metrics by name
in: query
items:
type: string
name: names
required: true
type: array
- description: Retrieve specific metric values
in: query
items:
type: string
name: values
required: false
type: array
- description: Retrieve metrics after this time
format: date-time
in: query
name: from
required: false
type: string
- description: Retrieve metrics before this time
format: date-time
in: query
name: to
required: false
type: string
- description: Period of timeslices in seconds
in: query
name: period
required: false
type: integer
- description: Summarize the data
in: query
name: summarize
required: false
type: boolean
- description: Return unformatted raw values
in: query
name: raw
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricDataResponse'
description: |+
<p>This API endpoint returns a list of values for each of the requested metrics. The list of available metrics
can be returned using the Metric Name API endpoint.</p>
<p>Metric data can be filtered by a number of parameters, including multiple names and values, and by time range.
Metric names and values will be matched intelligently in the background.</p>
<p>You can also retrieve a summarized data point across the entire time range selected by using the summarize
parameter.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>, <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/extracting-metric-data" target="_blank"> time range</a>
related considerations, and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Data
'/applications/{id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationResponse'
description: |
<p>This API endpoint deletes an application and all of its reported data.</p>
<p><strong>WARNING</strong>: Only applications that have stopped reporting can be deleted. This is an irreversible process
which will delete all reported data for this application.</p>
summary: Delete
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationResponse'
description: |+
<p>This API endpoint returns a single Application, identified by ID. The time range for summary data is the last 3-4 minutes.</p>
<p>See our documentation for a discussion of the
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank"> summary data output</a>.</p>
summary: Show
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Application ID
in: path
name: id
required: true
type: integer
- description: Application schema
in: body
name: application
required: true
schema:
$ref: '#/definitions/Application'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ApplicationResponse'
description: |+
<p>This API endpoint allows you to update certain parameters of your application.</p>
<p>The input is expected to be in <strong>JSON or XML</strong> format in the body parameter of the PUT request. The exact
schema is defined below. Any extra parameters passed in the body <strong>will be ignored</strong>.</p>
<p>See our documentation for a discussion and simple example of
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/changing-alias-your-application-v2" target="_blank"> updating</a>
an application.</p>
summary: Update
/browser_applications.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Filter by application name
in: query
name: 'filter[name]'
required: false
type: string
- description: Filter by application ids
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/BrowserApplicationResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint returns a list of the Browser Applications associated with your New Relic account.</p>
<p>Browser Applications can be filtered by their name, or by the application IDs.</p>
summary: List
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Browser Application Schema
in: body
name: browser_application
required: true
schema:
$ref: '#/definitions/BrowserApplication'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/BrowserApplicationResponse'
description: |
<p>This API endpoint allows you to create a standalone Browser Application.</p>
summary: Create
/components.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Filter components by name
in: query
name: 'filter[name]'
required: false
type: string
- description: Filter components by ids
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Filter components by the plugin
in: query
name: 'filter[plugin_id]'
required: false
type: integer
- description: Include component health status
in: query
name: health_status
required: false
type: boolean
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ComponentResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint returns a list of the plugin components associated with your New Relic account.
Plugins can be filtered by their name, the list of component IDs or a plugin ID.
See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/plugin-examples-v2/get-individual-plugin-components-v2" target="_blank"> listing components</a>
and <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>.</p>
summary: List
'/components/{component_id}/metrics.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Component ID
in: path
name: component_id
required: true
type: integer
- description: Filter metrics by name
in: query
name: name
required: false
type: string
- description: Pagination index (will be deprecated)
in: query
name: page
required: false
type: integer
- description: Cursor for next page (replacing page param)
in: query
name: cursor
required: false
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricParserResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>Return a list of known metrics and their value names for the given resource.</p>
<p>See our documentation for a discussion
on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank"> output pagination</a>
and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Names
'/components/{component_id}/metrics/data.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Component ID
in: path
name: component_id
required: true
type: integer
- description: Retrieve specific metrics by name
in: query
items:
type: string
name: names
required: true
type: array
- description: Retrieve specific metric values
in: query
items:
type: string
name: values
required: false
type: array
- description: Retrieve metrics after this time
format: date-time
in: query
name: from
required: false
type: string
- description: Retrieve metrics before this time
format: date-time
in: query
name: to
required: false
type: string
- description: Period of timeslices in seconds
in: query
name: period
required: false
type: integer
- description: Summarize the data
in: query
name: summarize
required: false
type: boolean
- description: Return unformatted raw values
in: query
name: raw
required: false
type: boolean
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricDataResponse'
description: |+
<p>This API endpoint returns a list of values for each of the requested metrics. The list of available metrics
can be returned using the Metric Name API endpoint.</p>
<p>Metric data can be filtered by a number of parameters, including multiple names and values, and by time range.
Metric names and values will be matched intelligently in the background.</p>
<p>You can also retrieve a summarized data point across the entire time range selected by using the summarize
parameter.</p>
<p>See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">
output pagination</a>, <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/extracting-metric-data" target="_blank"> time range</a>
related considerations, and for examples of <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/new-relic-rest-api-v2-getting-started#examples" target="_blank">requesting and using metric values</a>.</p>
summary: Metric Data
'/components/{id}.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Plugin ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/ComponentResponse'
description: |
<p>This API endpoint returns a single component, identified by its ID.
See our documentation for a discussion on <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/plugin-examples-v2/get-individual-plugin-components-v2#list_component_id" target="blank">listing components by ID</a>.</p>
summary: Show
/dashboards.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Contains title
in: query
name: 'filter[title]'
required: false
type: string
- description: Category is one of ('all' | 'favorite' | 'mine')
in: query
name: 'filter[category]'
required: false
type: string
- description: Created before given date
format: date-time
in: query
name: 'filter[created_before]'
required: false
type: string
- description: Created after given date
format: date-time
in: query
name: 'filter[created_after]'
required: false
type: string
- description: Updated before given date
format: date-time
in: query
name: 'filter[updated_before]'
required: false
type: string
- description: Updated after given date
format: date-time
in: query
name: 'filter[updated_after]'
required: false
type: string
- description: Sort is one of ('name' | 'recently viewed' | 'last edited')
in: query
name: sort
required: false
type: string
- description: Pagination index
in: query
name: page
required: false
type: integer
- description: Number of items per page
in: query
name: per_page
required: false
type: integer
responses:
'200':
description: No response was specified
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint allows you to fetch a paginated and sorted list
of Insights dashboards. Dashboards can be filtered by title, owner
email, category, created date, and updated date. This endpoint will
not return widget metadata.</p>
<p>For more information, see <a href="https://docs.newrelic.com/docs/insights-dashboard-api">Dashboard API documentation</a>.</p>
summary: List
post:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Dashboard schema
in: body
name: dashboard
required: true
schema:
$ref: '#/definitions/Dashboard'
responses:
'200':
description: No response was specified
description: |
<p>This API endpoint allows you to create a new Insights dashboard in the account that your API key has access to.</p>
<p>For more information, see <a href="https://docs.newrelic.com/docs/insights-dashboard-api">Dashboard API documentation</a>.</p>
summary: Create
'/dashboards/{id}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
description: |
<p>This API endpoint allows you to delete any Insights dashboard in the account that your API key has access to.</p>
<p>For more, see the <a href="https://docs.newrelic.com/docs/insights-dashboard-api">Dashboard API documentation</a>.</p>
summary: Delete
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
description: |
<p>This API endpoint allows you to view an existing dashboard and widget
metadata for a specific dashboard ID. If a widget contains data from
an account that the user does not have access to, the widget will
be returned as an “inaccessible” visualization type.</p>
<p>For more information, see <a href="https://docs.newrelic.com/docs/insights-dashboard-api">Dashboard API documentation</a>.</p>
summary: Show
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: integer
- description: Dashboard schema
in: body
name: dashboard
required: true
schema:
$ref: '#/definitions/Dashboard'
responses:
'200':
description: No response was specified
description: |
<p>This API endpoint allows you to update any existing Insights dashboard that you have permission to modify within the account that your API key has access to.</p>
<p>For more information, see <a href="https://docs.newrelic.com/docs/insights-dashboard-api">Dashboard API documentation</a>.</p>
summary: Update
/key_transactions.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Filter by name
in: query
name: 'filter[name]'
required: false
type: string
- description: Filter by policy IDs
in: query
items:
type: string
name: 'filter[ids]'
required: false
type: array
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/KeyTransactionResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |+
<p>This API endpoint returns a <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">paginated</a>
list of the key transactions associated with your New Relic account. The time range for summary data is the last 10 minutes.</p>
<p>Key transactions can be filtered by their name or list of IDs.</p>
<p>See our documentation for a discussion of
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: List
'/key_transactions/{id}.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Key transaction ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/KeyTransactionResponse'
description: |+
<p>This endpoint returns a single key transaction, identified by ID. The time range for summary data is the last 10 minutes.</p>
<p>See our documentation for a discussion of
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/summary-data-examples-v2" target="_blank">summary data output</a>.</p>
summary: Show
/labels.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Pagination index
in: query
name: page
required: false
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/LabelResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Links to related resources, in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). This will include a link with relation type `next` to the next page and `last` to the last page, unless this page is itself the last page.
description: |
<p>This API endpoint returns a <a href="https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/pagination-api-output" target="_blank">paginated</a> list of the labels available for the account.</p>
summary: List
put:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Label schema
in: body
name: label
required: true
schema:
$ref: '#/definitions/Label'
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/LabelResponse'
description: |
<p>This API endpoint will create a new label with the provided category and name.</p>
<p>Include the application and server IDs to which the label should be applied in the corresponding arrays.
You may omit the “applications” OR “servers” arrays, if not needed.</p>
<p>See our documentation for a discussion on obtaining
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/listing-your-app-id-metric-data-v2" target="_blank">application</a>
and
<a href="https://docs.newrelic.com/docs/apis/rest-api-v2/server-examples-v2/list-your-server-id-metric-data-v2" target="_blank">server</a> IDs.</p>
summary: Create
'/labels/{key}.json':
delete:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: 'Label key. Example: ''Language:Java'''
in: path
name: key
required: true
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/LabelResponse'
description: |
<p>When applications are provided, this endpoint will remove those applications from the label.</p>
<p>When no applications are provided, this endpoint will remove the label.</p>
summary: Delete
/mobile_applications.json:
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MobileApplicationResponse'
description: |
<p>This API endpoint returns a list of the Mobile Applications associated with your New Relic account.</p>
<p>MobileApplications can be filtered by their name, or by the application IDs.</p>
summary: List
'/mobile_applications/{id}.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Mobile Application ID
in: path
name: id
required: true
type: integer
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MobileApplicationResponse'
description: |
<p>This API endpoint returns a single Mobile Application, identified by ID. The time range for summary data is the last 30 minutes.</p>
summary: Show
'/mobile_applications/{mobile_application_id}/metrics.json':
get:
consumes:
- application/json
- application/xml
produces:
- application/json
- application/xml
parameters:
- description: Mobile application ID
in: path
name: mobile_application_id
required: true
type: integer
- description: Filter metrics by name
in: query
name: name
required: false
type: string
- description: Pagination index (will be deprecated)
in: query
name: page
required: false
type: integer
- description: Cursor for next page (replacing page param)
in: query
name: cursor
required: false
type: string
responses:
'200':
description: No response was specified
schema:
$ref: '#/definitions/MetricParserResponse'
headers:
link:
type: array
items:
type: string
collectionFormat: "csv"
description: |
Li