Create a filter. A filter keeps a search query for a list. Its name must be free among your filters with the same list_type, entity_type, project_id, and search_filter_group_id. To share it, give project_id and set is_shared to true. You must be a manager of this project, or an administrator. Otherwise the filter is created with is_shared set to false. If you give search_filter_group_id, the group must be in the same project and have the same is_shared value. Without a department_id, the filter takes the department of the group.
Body
Required
-
Filter name
Minimum length is
1, maximum length is200. -
Filter query as JSON string
Minimum length is
1, maximum length is500. -
Type of list this filter applies to
Maximum length is
80. -
Entity type this filter applies to
Maximum length is
80. -
Project identifier
-
Filter group identifier
-
Department identifier
curl -X POST "http://api.example.com/data/user/filters" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "My Custom Filter",
"query": "{\"project_id\": \"uuid\"}",
"list_type": "todo",
"entity_type": "Asset",
"project_id": "a24a6ea4-ce75-4665-a070-57453082c25",
"is_shared": false,
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d36",
"department_id": "c46c8gc6-eg97-6887-c292-79675204e47"
}'
import requests
url = "http://api.example.com/data/user/filters"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
params = {}
payload = {
"name": "My Custom Filter",
"query": "{\"project_id\": \"uuid\"}",
"list_type": "todo",
"entity_type": "Asset",
"project_id": "a24a6ea4-ce75-4665-a070-57453082c25",
"is_shared": false,
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d36",
"department_id": "c46c8gc6-eg97-6887-c292-79675204e47"
}
response = requests.post(
url,
headers=headers,
params=params,
json=payload
)
response.raise_for_status()
if response.content:
print(response.json())
{
"name": "My Custom Filter",
"query": "{\"project_id\": \"uuid\"}",
"list_type": "todo",
"entity_type": "Asset",
"project_id": "a24a6ea4-ce75-4665-a070-57453082c250",
"is_shared": false,
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d360",
"department_id": "c46c80c6-e097-6887-c292-79675204e470"
}
{
"id": "d57d91d7-f108-7998-d403-80786315f580",
"name": "My Custom Filter",
"query": "{\"project_id\": \"uuid\"}",
"list_type": "todo",
"entity_type": "Asset",
"project_id": "e68e02e8-0219-8009-e514-918974260690",
"is_shared": false,
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:30:00Z"
}