Management API sort functionality

Hi,

I use the filter field of the list identites endpoint to read identites filtered by tags.
So at the moment I use icontains in combination with my tag called email.
tags.email icontains "test"

No I also want to sort the result and found out that I can attach the sort string to the filter.
Adding a sort by name works file
tags.email icontains "test" sort by name

But when I try to sort by my tag field it does not work and I receive the following error
no such sort field: tags.email

Is the sorting only supported by some predefined fields? And if so can someone tell me where I can find that list?

Thanks and best regards
Philipp

Hi @philipp

We currently support filtering/sorting by a limited number of fields. You can see the list in the JSON output. For example:

$ ziti edge list services 'name="invalid"' -j

gives the output:

{
    "data": [],
    "meta": {
        "filterableFields": [
            "configs",
            "updatedAt",
            "terminatorStrategy",
            "id",
            "createdAt",
            "tags",
            "roleAttributes",
            "isSystem",
            "name"
        ],
        "pagination": {
            "limit": 10,
            "offset": 0,
            "totalCount": 0
        }
    }
}

The set of sortable fields is generally a subset of the filterable fields. Set fields like roleAttributes and map fields like tags aren't currently usable as sort fields. Having said that, there's no reason that sorting by a map entry couldn't work. However, tags are untyped, so a tag value on one entity might not exist or have a different type than the same key on a different entity.

If it's a feature that would improve your quality of life, please file an issue and I'll see if we can get it into an upcoming release.

Cheers,
Paul