Content API: Sort by random and multiple tags

I'm currently working on a project the relies a lot on the Content API. Most of the stuff works very well out of the box and/or was documented.

There are two issues right now where I cannot seem to find an answer:

Sort by random

I am able to sort by a field (/endpoint?sort=field), like it says in the docs. But for one view, a random order would be really sweet. I tried the more obvious ones "rand" and "random", but they have no effect. Is it possible to sort a collection randomly?

Filter by multiple tags

I have a functions that "talks" to the API. It basically looks like this:

public function getTaggedEntriesInCollection(string $tag, string $collection = null, int $limit = null): array
{
    $response = $this->connect("/collections/{$collection}/entries?filter[tags:contains]={$tag}&limit={$limit}");

    if ($response->successful()) {
        return $response->json()['data'];
    }

    return [];
}

This works fine. But I'd like to extend this and allow $tags to be an array. So the applied filter filter[tags:contains]={$tag} should maybe include an array, like so: filter[tags:contains]=['tag1', 'tag2'] or something like that. Would this be somehow possible? The tags are all part of the same taxonomy.

>>>>>>> Unanswered <<<<<<<
1 Reply
1 Follower