# Filter syntax for endpoint

**URL:** https://discourse.getcockpit.com/t/filter-syntax-for-endpoint/1001
**Category:** Support
**Created:** [September 5, 2019, 11:42am UTC](https://discourse.getcockpit.com/t/filter-syntax-for-endpoint/1001 "2019-09-05T11:42:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tof](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tof](https://discourse.getcockpit.com/u/tof)
#### Post date: [September 5, 2019, 11:42am UTC](https://discourse.getcockpit.com/t/filter-syntax-for-endpoint/1001/1 "2019-09-05T11:42:49Z")

</div>

Hi, I’m looking for the correct syntax about filter in a endpoint/php call, in order for a specific filter item to accept several values.

Here I have a working piece of code that works to retrieve “events” for which “ **type** ” = ‘workshop’

`$eventstocome = cockpit("collections")->find("events", ['filter' => ['published'=> true, 'ended'=> false, 'type' => 'workshop'],'limit'=> 100, 'sort'=>['startdate'=> 1] ]);`

But I would like to retrieve “events” that match “ **type** ” either ‘workshop’ or ‘spectacle’ or ‘lecture’.  
Is there any syntax with “OR” or something like “in\_array” that would make it feasible ?

Thanks for your help.

---

<div class="post-metadata">

### Author: ![artur](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/artur/32/4_2.png) [@artur](https://discourse.getcockpit.com/u/artur)
#### Post date: [September 5, 2019, 2:12pm UTC](https://discourse.getcockpit.com/t/filter-syntax-for-endpoint/1001/2 "2019-09-05T14:12:30Z")

</div>

```auto
$eventstocome = cockpit("collections")->find("events", [
    'filter' => [
        'published'=> true, 
        'ended'=> false, 
        '$or' => [
            ['type' => 'workshop'],
            ['type' => 'spectacle'],
            ['type' => 'lecture'],
        ]
    ],
    'limit'=> 100, 
    'sort'=>['startdate'=> 1] 
]);

```

OR

```auto
$eventstocome = cockpit("collections")->find("events", [
    'filter' => [
        'published'=> true, 
        'ended'=> false,
        'type' => ['$in' => ['workshop', 'spectacle', 'lecture']]
    ],
    'limit'=> 100, 
    'sort'=>['startdate'=> 1] 
]);

```

---

<div class="post-metadata">

### Author: ![tof](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tof](https://discourse.getcockpit.com/u/tof)
#### Post date: [September 5, 2019, 10:49pm UTC](https://discourse.getcockpit.com/t/filter-syntax-for-endpoint/1001/3 "2019-09-05T22:49:48Z")

</div>

Many thanks Artur, it’s exactly what I was looking for !

I’ve seen these operators _$or_ and _$in_ in my searches but always related to json API, and I did not managed to get the exact syntax for php.

And thanks again for the quick answer.
