How to sort an API query by a value in list ?

Hi.

How may I sort a query by a value of a key that is part of a list of objects?

For example "idConsulta" shown in following image.