BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
BigRider
Obsidian | Level 7

 Hi Experts,

 

I have a particular requirement from a customer, they would like to send a e-mail automatically when an alert is created. 

 

1. Is there an automatic feature directly in SAS Visual Investigator to do that ?

2. There is a API endpoint to get alerts created filtering from a specific date as parameter ? 

3. Should we create a process reading directly from internal SVI database (Postgres) ?

 

Thanks in advance,

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
_austin_
SAS Employee

Hello,

1. No, there is not an automatic feature for sending emails on alert creation.

 

2. Sure, there is an REST endpoint for finding alerts created since a specific timestamp. This URL will find all alerts created after midnight on September 6th. 

GET http://{{host}}:{{port}}/svi-alert/alerts?filter=gt(alertVersionTimeStamp,2022-09-06)
You could also use an ISO 8601 timestamp rather than a date but make sure to include timezone information.
GET http://{{host}}:{{port}}/svi-alert/alerts?filter=gt(alertVersionTimeStamp,2022-09-05T19:00:00.000-05:00) 
If you wanted to limit your query to a certain alert domain, you could enhance the query like this:
GET http://{{host}}:{{port}}/svi-alert/alerts?filter=and(gt(alertVersionTimeStamp,2022-09-06),eq(domainId,mydomain))
 
Note: I am matching on the field alertVersionTimeStamp, not creationTimeStamp. creationTimeStamp is only set when the first version of the alert is created. If the alert is closed and then re-opened for new activity some time later, the alertVersionTimeStamp will be set for the new "version" of the alert but creationTimeStamp will remain set to the time the first alert version was created.
 
3. If you want to create an external process that polls for new alerts and sends emails, I would suggest you use the REST call rather than reading from the database directly.

View solution in original post

2 REPLIES 2
_austin_
SAS Employee

Hello,

1. No, there is not an automatic feature for sending emails on alert creation.

 

2. Sure, there is an REST endpoint for finding alerts created since a specific timestamp. This URL will find all alerts created after midnight on September 6th. 

GET http://{{host}}:{{port}}/svi-alert/alerts?filter=gt(alertVersionTimeStamp,2022-09-06)
You could also use an ISO 8601 timestamp rather than a date but make sure to include timezone information.
GET http://{{host}}:{{port}}/svi-alert/alerts?filter=gt(alertVersionTimeStamp,2022-09-05T19:00:00.000-05:00) 
If you wanted to limit your query to a certain alert domain, you could enhance the query like this:
GET http://{{host}}:{{port}}/svi-alert/alerts?filter=and(gt(alertVersionTimeStamp,2022-09-06),eq(domainId,mydomain))
 
Note: I am matching on the field alertVersionTimeStamp, not creationTimeStamp. creationTimeStamp is only set when the first version of the alert is created. If the alert is closed and then re-opened for new activity some time later, the alertVersionTimeStamp will be set for the new "version" of the alert but creationTimeStamp will remain set to the time the first alert version was created.
 
3. If you want to create an external process that polls for new alerts and sends emails, I would suggest you use the REST call rather than reading from the database directly.
BigRider
Obsidian | Level 7

Thanks @_austin_  !

 

It´s a good way to meet customer requirments.

 

Regards,

Bila