Summary
Adds the ability to configure custom deletion policies for posts and/or files for specific teams and/or channels so that when the daily retention job runs it can selectively delete those resources based on their configuration.
API
Existing API, listed for reference
GET /api/v4/data_retention/policy
(existing). Retrieves the global retention settings:
{ "message_deletion_enabled": false, "file_deletion_enabled": false, "message_retention_cutoff": 0, "file_retention_cutoff": 0 }
New API endpoints being added
Retention Policies
POST /api/v4/retention_policies
to create a new retention policy with the following payload
{ "file_retention_duration": 2, "message_retention_duration": 4, "display_name": "foo" }
PUT /api/v4/retention_policies/:policy_id/patch
to patch a retention policy
{ "display_name": "foo2", "file_retention_duration": 90, "message_retention_duration": 365 }
GET /api/v4/retention_policies/:policy_id
to get a retention policy by id
DELETE /api/v4/retention_policies/:policy_id
to delete a retention policy
GET /api/v4/retention_policies?page=0&per_page=100
to list retention policies
{ "policies": [ { "file_retention_duration": 2, "message_retention_duration": 2, "display_name": "foo" } ], "total_count": 1 }
Retention Policies Teams
GET /api/v4/retention_policies_teams
{ "policies": [ { "policy_id": "m8zoumpj9pn9zexospoxi5dzoc", "team_id": "z7rxbxbfb7yxdydxzi8pestath" } ], "total_count": 1 }
POST /api/v4/retention_policies_teams
{ "policy_id": "m8zoumpj9pn9zexospoxi5dzoc", "team_id": "z7rxbxbfb7yxdydxzi8pestath" }
DELETE /api/v4/retention_policies_teams/team_id
Retention Policies Channels
GET /api/v4/retention_policies_channels
{ "policies": [ { "policy_id": "m8zoumpj9pn9zexospoxi5dzoc", "channel_id": "z7rxbxbfb7yxdydxzi8pestath" } ], "total_count": 1 }
POST /api/v4/retention_policies_channels
{ "policy_id": "m8zoumpj9pn9zexospoxi5dzoc", "channel_id": "z7rxbxbfb7yxdydxzi8pestath" }
DELETE /api/v4/retention_policies_channels/channel_id
Database
RetentionPolicies table
Column name | Description |
---|---|
Id | varchar, primary key |
DisplayName | varchar |
PostDuration | int, the duration in days to keep posts |
FileDuration | int, the duration in days to keep files |
RetentionPoliciesChannels
Column name | Description |
---|---|
PolicyId | varchar, the RetentionPolicies.Id foreign key |
ChannelId | varchar, the Channels.Id foreign key |
RetentionPoliciesTeams
Column name | Description |
---|---|
PolicyId | varchar, the RetentionPolicies.Id foreign key |
TeamId | varchar, the Teams.Id foreign key |