AE-2325: Alert (mail) Rest Implementation
Review Request #1337 — Created Jan. 23, 2026 and submitted — Latest diff uploaded
| Information | |
|---|---|
| apoorva.sn | |
| AMP | |
| amp_4_0 | |
| AE-2325 | |
| Reviewers | |
| pmurugaiyan, pradeep, shuinvy | |
Problem
Alert (mail) Rest Implementation
Solution
Have made changes for Alert(mail) Rest Implementation which includes having Rest endpoint, changes to controller and service layer and persistence
of saving and retrieving the data
Notification
SMTP Settings
curl 'http://127.0.0.1:8000/notification/smtp_setting' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3' \
-b 'csrftoken=xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3; hive_key=1; django_language=en; csrf_token=xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3; current_user=array; hive_sess=5a5ff305-c47d-42d8-ab1a-57477ad5536d' \
--data-raw '{
"enabled": true,
"host": "smtp.office365.com",
"port": 587,
"user": "bugz@arraynetworks.net",
"password": "fMoTp1fXpN0UhMia#NP2CW4j2",
"from_address": "bugz@arraynetworks.net",
"from_name": "Apoorv"
}' \
--insecureResponse:
{"status": "SMTP settings saved"}
Email Notification:
curl 'http://127.0.0.1:8000/notification/mail' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3' \
-b 'csrftoken=xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3; hive_key=1; django_language=en; csrf_token=xxvkNpRdAPbvXUGxXPYJQk7et3Z7NyV3; current_user=array; hive_sess=5a5ff305-c47d-42d8-ab1a-57477ad5536d' \
--data-raw '{
"name": "test",
"type": "email",
"addresses": [
"apoorva.sn@arraynetworks.net"
]
}' \
--insecurecurl 'http://127.0.0.1:8000/notification/mail' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:IUcu6fewan2GNkwI9TuHyFawIwahHeTW' \
-b 'csrftoken=IUcu6fewan2GNkwI9TuHyFawIwahHeTW; hive_key=1; django_language=en; csrf_token=IUcu6fewan2GNkwI9TuHyFawIwahHeTW; current_user=array; hive_sess=72fa63ab-36bd-4051-a4ee-c860532c63e2' \
--data-raw '{
"name": "test2",
"type": "email",
"addresses": [
"test2@arraynetworks.net"
]
}' \
--insecureResponse:
{"status": "Notification saved"}
GET SMTP Settings
====================curl 'http://127.0.0.1:8000/notification/smtp_setting' \
-X GET \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:Jog4Ayh7FFtOnMgjWJ33wvm1WmiC40cq' \
-b 'csrftoken=Jog4Ayh7FFtOnMgjWJ33wvm1WmiC40cq; hive_key=1; django_language=en; csrf_token=Jog4Ayh7FFtOnMgjWJ33wvm1WmiC40cq; current_user=array; hive_sess=a58b386d-c233-41de-a37b-64d862b44026' \
--insecureResponse:
{"Host": "smtp.office365.com", "Port": 587, "User": "bugz@arraynetworks.net", "Enabled": true, "Password": "fMoTp1fXpN0UhMia#NP2CW4j2", "from_name": "Apoorv", "from_address": "bugz@arraynetworks.net"}[root@AN admin]#
GET Notification
==================curl 'http://127.0.0.1:8000/notification/mail' \
-X GET \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:IUcu6fewan2GNkwI9TuHyFawIwahHeTW' \
-b 'csrftoken=IUcu6fewan2GNkwI9TuHyFawIwahHeTW; hive_key=1; django_language=en; csrf_token=IUcu6fewan2GNkwI9TuHyFawIwahHeTW; current_user=array; hive_sess=72fa63ab-36bd-4051-a4ee-c860532c63e2' \
--insecureResponse:
[{"name": "test2", "type": "email", "setting": {"addresses": ["test2@arraynetworks.net"]}, "time": "2026-01-23T18:06:33.323"}, {"name": "test", "type": "email", "setting": {"addresses": ["apoorva.sn@arraynetworks.net"]}, "time": "2026-01-23T16:38:02.889"}]
