diff --git a/docs/sources/oncall-api-reference/alertgroups.md b/docs/sources/oncall-api-reference/alertgroups.md index 42931b18..e5126fb7 100644 --- a/docs/sources/oncall-api-reference/alertgroups.md +++ b/docs/sources/oncall-api-reference/alertgroups.md @@ -36,7 +36,8 @@ The above command returns JSON structured in the following way: "permalinks": { "slack": "https://ghostbusters.slack.com/archives/C1H9RESGA/p135854651500008", "telegram": "https://t.me/c/5354/1234?thread=1234" - } + }, + "silenced_at": "2020-05-19T13:37:01.429805Z", } ], "current_page_number": 1, diff --git a/engine/apps/public_api/serializers/incidents.py b/engine/apps/public_api/serializers/incidents.py index 24ec1c6b..90cf4abf 100644 --- a/engine/apps/public_api/serializers/incidents.py +++ b/engine/apps/public_api/serializers/incidents.py @@ -43,6 +43,7 @@ class IncidentSerializer(EagerLoadingMixin, serializers.ModelSerializer): "acknowledged_by", "title", "permalinks", + "silenced_at", ] def get_title(self, obj): diff --git a/engine/apps/public_api/tests/test_alert_groups.py b/engine/apps/public_api/tests/test_alert_groups.py index 247239ec..e3902f22 100644 --- a/engine/apps/public_api/tests/test_alert_groups.py +++ b/engine/apps/public_api/tests/test_alert_groups.py @@ -29,6 +29,11 @@ def construct_expected_response_from_alert_groups(alert_groups): acknowledged_at = alert_group.acknowledged_at.isoformat() acknowledged_at = acknowledged_at[:-6] + "Z" + silenced_at = None + if alert_group.silenced_at: + silenced_at = alert_group.silenced_at.isoformat() + silenced_at = silenced_at[:-6] + "Z" + def user_pk_or_none(alert_group, user_field): u = getattr(alert_group, user_field) if u is not None: @@ -52,6 +57,7 @@ def construct_expected_response_from_alert_groups(alert_groups): "telegram": None, "web": alert_group.web_link, }, + "silenced_at": silenced_at, } ) return {