Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Sort for server names rest API v2 list

restapi
servers
api
application

#1

https://docs.newrelic.com/docs/apis/rest-api-v2/server-examples-v2/list-your-server-id-metric-data-v2#list_sorted_health_status

Hello,
I am using the “Rest API V2” to get server list, paged to 200 rows each request.
because of the “paging” capability, I need also the sort option, but it doesn’t work.
I found way to request the server list sorted by name or health_status \ reporting, but the results aren’t sorted.
the same problem relevant also to the applications list command in the Rest API.
Please fix this…
Thanks
Moshe


#2

Can you provide an example of a situation where the sorting is not work so we can reproduce this and investigate, please?

You can provide a Permalink to an account that exhibits the issue andno one else will be able to view it. Also, an example ‘curl’ query that exhibits the symptom would be very helpful.


#3

Hi,
Thanks for your reply!
I am sorry, I found now that:
https://api.newrelic.com/v2/servers.json?page=1&sort[health_status]=true
sort works well, but:
https://api.newrelic.com/v2/servers.json?page=1&sort[reporting]=true
doesn’t return sorted results.

Another nice feature will be to be able to sort descending, I mean, to get the results in opposite order.

Thanks
Moshe


#4

I’m afraid that'sort[health_status]=true is the only sort option available.
sort[reporting]=true is not a valid option.

JSON, by definition, does not provide data in a sorted form. Sorting the data is expected to be done post retrieval. We can submit a feature request for this but any sorting will add to the processing time accrued by the API, thus slowing it down and adding to the load on the API servers. This is especially true for customers with very large numbers of server and/or applications.


#5

Hello,
Is there any news regarding sorting option? Is there any other sort options available besides health_status? Is sorting in descending order is planned to be supported? We cannot sort the retrieved data due to paging capability we are using.

Regards,
Or Shelly


#6

HI there @or.shelly -

Sorry for the long delay in responding. This particular API endpoint is being deprecated as we closed down our Servers product:

I would love to hear more about what you are trying to accomplish to see which API might be a better fit for you.