API v2: Filter applications based on label

Good morning,

When I try to use the API to retrieve the applications and filter the results based on a certain label, I still get results that do not have that label.

curl -X GET “https://api.newrelic.com/v2/applications.json” -H “X-Api-Key:(insert API key)” -i -d “filter[labels]=Environment:Production”


Other questions I have seen are:

These concern the servers and multiple labels, but I just want one label to work.

How can I apply filtering of one label?

1 Like

Hi @jeroenw - There is no quick way except to write a script which will return the applications which have a particular label and then use the applicaton API to retrieve the application label.

This has been raised as a feature request and you should vote on that.

1 Like

Hi @stefan_garnham, thanks for your response. As applications are added frequently, using a script which requires updating would be not very pragmatic… :wink: It would be so much easier if I could just have one API call and get all resources! :smiley:

Thanks for mentioning the feature request, I have added my vote but it doesn’t have a lot of backing right now… I will try to find another way.

The Labels API (https://rpm.newrelic.com/api/explore/labels/list) contains a list of associated applications. I’ll use that as a starting point and retrieve the applications that way.

1 Like