Is sorting of a collection returned by API possible? Adding thumbnail-urls possible?

I’m receiving a collection of child-pages currently via API:

/api/pages/lids/children/?limit=20&select=files,content,slug,title&page=1

This works fine. I would like to reverse the sorting, though. Is there a simple way to do that?

Also I’d like to add the thumbnail-URL to the “select=files”-objects. Maybe there’s a way I didn’t see.

The search endpoint has optional parameters for sorting the results: https://getkirby.com/docs/reference/api/pages/children-search

If you pass an empty string as search parameter, the complete collection is returned. Can’t find anything else that looks useful.

Thanks!
/api/pages/lids/children/search?q=
doesn’t return any results, unfortunately.

Adding an “a” to the q= works, but then I won’t get all results.

Also I can’t use “select” with search it seems.

Is there a way to define custom collections, like I can do in a template? Like saying for “/api/overview” I’d like to return all pages with the content, slug, and the first file’s thumbnail?

Since you can create your own custom API routes, you could make them behave exactly as you want.

Thanks! When I add a plugin like in the first example, suddenly all request (not only to /api) serve the index.php from the plugin-folder like it’s not being interpreted by php. I’m seeing the index.php source in the browser. What am I missing?

UPDATE:
Never mind I forgot <?php