jmsanch
jmsanch

Reputation: 11

Newrelic : Filtering rest/json API requests by ID

I'm working on a custom dashboard, and I want to pull specific information from some of our monitoring tools. We use new relic, and I would like to show the response time of one of our applications on our dashboard. Using New Relics API explorer I got this:

 curl -X GET 'https://api.newrelic.com/v2/applications.json' \
 -H 'X-Api-Key:myapikey' -i \
 -G -d 'filter[ids]=1739407' 

I'm still learning the ins and outs of all this, and got this:

$ch = curl_init('https://api.newrelic.com/v2/applications.json');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Api-Key:myqpikey']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
    print "Error: " . curl_error($ch);
}
curl_close($ch);

So this, of course, echoes all applications. What I would like to know is given the curl command above from the new relic explorer, how would I filter by that ID? If someone is more versed in New Relic and knows a better way to accomplish this, I'm open for suggestions.

Upvotes: 0

Views: 123

Answers (1)

jmsanch
jmsanch

Reputation: 11

So I figured out. It was overly obvious, and shamefully I missed it. Hopefully by posting the answer others will not feel the shame I felt.

    https://api.newrelic.com/v2/applications.json?filter[ids]=1739407

Upvotes: 1

Related Questions