# Saved Search

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/savedsearches/4" method="get" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}

## add saved search

<mark style="color:green;">`POST`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/savedsearches`

#### Request Body

| Name          | Type    | Description                                      |
| ------------- | ------- | ------------------------------------------------ |
| filter        | Object  | The flter keyword                                |
| role          | String  | Roles                                            |
| view          | String  | View type for saved search                       |
| description   | String  | Search description                               |
| name          | String  | name of search                                   |
| user\_id      | String  | The user identifier                              |
| view\_options | String  | View options                                     |
| featured      | Boolean | Set True for featured and false for not featured |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "id": 10,
    "url": null,
    "user": {
        "id": 2,
        "url": "http://localhost:8000/api/v3/users/2"
    },
    "filter": {
        "q": "test"
    },
    "name": "Test search",
    "description": "",
    "view": "list",
    "view_options": null,
    "role": null,
    "featured": false,
    "created": "2022-11-01T07:13:17+00:00",
    "updated": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

## edit saved search by ID

<mark style="color:orange;">`PUT`</mark> `https://ushahididocs.api.ushahidi.io/api/v3/savedsearches/4`

#### Request Body

| Name          | Type    | Description                                      |
| ------------- | ------- | ------------------------------------------------ |
| filter        | Object  | The flter keyword                                |
| role          | String  | Roles                                            |
| view          | String  | View type for saved search                       |
| description   | String  | Search description                               |
| name          | String  | name of search                                   |
| user\_id      | String  | The user identifier                              |
| view\_options | String  | View options                                     |
| featured      | Boolean | Set True for featured and false for not featured |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "id": 10,
    "url": null,
    "user": {
        "id": 2,
        "url": "http://localhost:8000/api/v3/users/2"
    },
    "filter": {
        "q": "test"
    },
    "name": "Test search",
    "description": "",
    "view": "list",
    "view_options": null,
    "role": null,
    "featured": false,
    "created": "2022-11-01T07:13:17+00:00",
    "updated": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}
```

{% endtab %}
{% endtabs %}

{% openapi src="<https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json>" path="/api/v3/savedsearches/8" method="delete" %}
[UshahidiV3.json](https://content.gitbook.com/content/tXIYKGMTeHub5C8O9fER/blobs/TC8KXqdBoVrA1ZGmo9Kk/UshahidiV3.json)
{% endopenapi %}
