Sort allows you to sort objects in ascending (default) or descending order. Similar to filter keys, a sort-path key is used to specify the field to sort the objects by, using a dot-delimited path.
The following example shows how to sort findings based on create time, in descending order:
endorctl api list --resource Finding \
--sort-path "meta.create_time" \
--sort-order descending
curl --get \
--header "Authorization: Bearer $ENDOR_TOKEN" \
--url "https://api.endorlabs.com/v1/namespaces/$ENDOR_NAMESPACE/findings?list_parameters.sort.path=meta.create_time&list_parameters.sort.order=SORT_ENTRY_ORDER_DESC"
@baseUrl = https://api.endorlabs.com
@token = <insert-access-token>
@namespace = <insert-namespace>
###
GET {{baseUrl}}/v1/namespaces/{{namespace}}/findings?list_parameters.sort.path=meta.create_time7list_parameters.sort.order=SORT_ENTRY_ORDER_DESC HTTP/1.1
Authorization: Bearer {{token}}
Sort order
The following sort orders are supported:
Option | Description |
---|---|
ascending | Ascending order (default) |
descending | Descending order |
Value | Description |
---|---|
SORT_ENTRY_ORDER_ASC | Ascending order (default) |
SORT_ENTRY_ORDER_DESC | Descending order |