Hi everyone,
I am trying to use REST call to reactivate a closed alert so I found this one: https://developer.sas.com/rest-apis/svi-alert/createPerformActions
and the code I wrote works and reactivates the alert properly.
Then I made a loop that will loop through a list of alerts and reactivate every one of them, but that only works for the first one, all other alerts give this response:
{"errorCode":403,"message":"Forbidden","details":["path: /svi-alert/alertActions/REACTIVATE"],"links":[],"version":2,"httpStatusCode":403}This also happens if I try to reactivate only one alert. The first one reactivates, and every other returns 403 Forbidden.FYI
I found out what was wrong.
The payload was in the wrong format... I was trying with this payload:
{ "items": [
{
"alertIds": ["alert1"],
"actionType": "REACTIVATE",
"user": "user"
},
{
"alertIds": ["alert2"],
"actionType": "REACTIVATE",
"user": "user"
},
{
"alertIds": ["alert3"],
"actionType": "REACTIVATE",
"user": "user"
}
]}But it should be like this:
{ "items": [
{
"alertIds": ["alert1", "alert2", "alert3"],
"actionType": "REACTIVATE",
"user": "user"
}
]}
Hope this helps someone 🙂
Regards,
David
FYI
I found out what was wrong.
The payload was in the wrong format... I was trying with this payload:
{ "items": [
{
"alertIds": ["alert1"],
"actionType": "REACTIVATE",
"user": "user"
},
{
"alertIds": ["alert2"],
"actionType": "REACTIVATE",
"user": "user"
},
{
"alertIds": ["alert3"],
"actionType": "REACTIVATE",
"user": "user"
}
]}But it should be like this:
{ "items": [
{
"alertIds": ["alert1", "alert2", "alert3"],
"actionType": "REACTIVATE",
"user": "user"
}
]}
Hope this helps someone 🙂
Regards,
David
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.