filters.md 2.55 KB
Newer Older
Eugen Rochko's avatar
Eugen Rochko committed
1
---
Eugen Rochko's avatar
Eugen Rochko committed
2
title: Filters
Eugen Rochko's avatar
Eugen Rochko committed
3 4
menu:
  docs:
Eugen Rochko's avatar
Eugen Rochko committed
5
    parent: rest-api
Eugen Rochko's avatar
Eugen Rochko committed
6 7
    weight: 10
---
Eugen Rochko's avatar
Eugen Rochko committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

## GET /api/v1/filters

Text filters the user has configured that potentially must be applied client-side.

Returns array of [Filter]({{< relref "entities.md#filter" >}})

### Resource information

{{< api_method_info auth="Yes" user="Yes" scope="read read:filters" version="0.0.0" >}}

## POST /api/v1/filters

Create a new filter.

Returns [Filter]({{< relref "entities.md#filter" >}})

### Resource information

{{< api_method_info auth="Yes" user="Yes" scope="write write:filters" version="0.0.0" >}}

### Parameters

Eugen Rochko's avatar
Eugen Rochko committed
31 32 33 34 35 36
|Name|Description|Required|
|----|-----------|:------:|
| `phrase` | Keyword or phrase to filter | Required |
| `context` | Array of strings that means filtering context. Each string is one of `home`, `notifications`, `public`, `thread`. At least one context must be specified. | Required |
| `irreversible` | Irreversible filtering will only work in `home` and `notifications` contexts by fully dropping the records. Otherwise, filtering is up to the client. | Optional |
| `whole_word` | Whether to consider word boundaries when matching | Optional |
Eugen Rochko's avatar
Eugen Rochko committed
37
| `expires_in` | Number that indicates seconds. Filter will be expire in seconds after API processed. Leave blank for no expiration | Optional |
Eugen Rochko's avatar
Eugen Rochko committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

## GET /api/v1/filters/:id

A text filter.

Returns [Filter]({{< relref "entities.md#filter" >}})

### Resource information

{{< api_method_info auth="Yes" user="Yes" scope="read read:filters" version="0.0.0" >}}

## PUT /api/v1/filters/:id

Update a text filter.

Returns [Filter]({{< relref "entities.md#filter" >}})

### Resource information

{{< api_method_info auth="Yes" user="Yes" scope="write write:filters" version="0.0.0" >}}

### Parameters

Eugen Rochko's avatar
Eugen Rochko committed
61 62 63 64 65 66
|Name|Description|Required|
|----|-----------|:------:|
| `phrase` | Keyword or phrase to filter | Required |
| `context` | Array of strings that means filtering context. Each string is one of `home`, `notifications`, `public`, `thread`. At least one context must be specified. | Required |
| `irreversible` | Irreversible filtering will only work in `home` and `notifications` contexts by fully dropping the records. Otherwise, filtering is up to the client. | Optional |
| `whole_word` | Whether to consider word boundaries when matching | Optional |
Eugen Rochko's avatar
Eugen Rochko committed
67
| `expires_in` | Number that indicates seconds. Filter will be expire in seconds after API processed. Leave blank to not change | Optional |
Eugen Rochko's avatar
Eugen Rochko committed
68 69 70 71 72 73 74 75

## DELETE /api/v1/filters/:id

Delete a text filter.

### Resource information

{{< api_method_info auth="Yes" user="Yes" scope="write write:filters" version="0.0.0" >}}