New Relic's REST API lets you retrieve data from and push data to New Relic tools, as well as to configure features and perform delete operations. You can also use the API Explorer to understand the data available to you via the REST API, to obtain curl commands, and to see JSON responses.
SetupThe REST API command structure follows this template:
The GET
command could also be a POST
or DELETE
, depending on the query intent.
To understand the placeholders, keep reading.
TipOur examples use curl as a common command line tool to pull metric timeslice data from the REST API. However, you can use any method to make your REST requests. The curl
commands include target URLs, header information, and data which are relevant for any request mechanism.
The API calls require a URL to specify the location from which the data will be accessed. You must replace the placeholder URL
with the appropriate URL which will change depending on the type of data being requested. In general the URL follows this template:
https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.json
The $APP_ID specifies the exact application or product for which the data is being requested. The information following this parameter will vary depending on the data request.
If you have an EU region account, the URL is:
api.eu.newrelic.com/v2/applications/$APP_ID/metrics/data.json
Tip
You can retrieve XML data instead of JSON by replacing .json
with .xml
.
$API_KEY
New Relic API requires a user API key: The user key is also used for our NerdGraph API.
In our REST API examples, we borrow the API key placeholder $API_KEY
from Unix shell programming. Be sure to replace that and other user-specific variables when forming calls.
The PAYLOAD
contains the query details, which define:
See the following docs for example REST API use cases:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4