Update a filter. The filter must be yours. An administrator can update the filters of all the users. The filter stays in its project. A project_id in the body is ignored. A null department_id removes the department. A new name must be free among the filters of the owner with the same list_type, entity_type, project_id, and search_filter_group_id. To set is_shared to true, the filter must have a project, and you must be a manager of this project or an administrator. Otherwise is_shared is set to false. A change of department on a filter that stays shared needs the same role. Otherwise it is ignored. If the filter is in a group, is_shared must keep the value of the group. A new group must be in the project of the filter. The filter takes the department of its new group, unless the group has none or the body changes department_id. A null search_filter_group_id takes the filter out of its group.
Responses
-
The updated filter
-
The body is not valid, the name is already used in this list, the new filter group is in another project, or is_shared differs from the value of the filter group
-
You use a bot token
-
You have no filter with this identifier, or the filter group or the department does not exist
curl -X PUT "http://api.example.com/data/user/filters/a24a6ea4-ce75-4665-a070-57453082c25" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Filter Name",
"search_query": "{\"status\": \"active\"}",
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d36",
"is_shared": true,
"department_id": "d57d9hd7-fh08-7998-d403-80786315f58"
}'
import requests
url = "http://api.example.com/data/user/filters/a24a6ea4-ce75-4665-a070-57453082c25"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
params = {}
payload = {
"name": "Updated Filter Name",
"search_query": "{\"status\": \"active\"}",
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d36",
"is_shared": true,
"department_id": "d57d9hd7-fh08-7998-d403-80786315f58"
}
response = requests.put(
url,
headers=headers,
params=params,
json=payload
)
response.raise_for_status()
if response.content:
print(response.json())
{
"name": "Updated Filter Name",
"search_query": "{\"status\": \"active\"}",
"search_filter_group_id": "b35b7fb5-df86-5776-b181-68564193d360",
"is_shared": true,
"department_id": "d57d91d7-f108-7998-d403-80786315f580"
}
{
"id": "e68e02e8-0219-8009-e514-918974260690",
"name": "Updated Filter Name",
"query": "{\"status\": \"active\"}",
"list_type": "todo",
"entity_type": "Asset",
"project_id": "f79f13f9-1320-9010-f625-a09008537180",
"is_shared": true,
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:30:00Z"
}