Skip to content

Modify Alert

Request URL

POST /alert/:alertTypeId

Description

Toggle a specific alert from "isEnabled": true to "isEnabled": false or vice versa. The alert type is identified by a path parameter. The request body specifies whether to toggle the "isEnabled" property to true or false.

Schema

Property table for alert/:alertTypeId

Property Description Required Schema
alertTypeId Name of alert type Yes {
  "type": "string"
}
isEnabled true if enabled No {
  "type": "boolean",
  "nullable": true
}

Request Body

{
    "isEnabled": true
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "isEnabled": true
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/alert/:alertTypeId',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/alert/:alertTypeId" --data "{    \"isEnabled\":true}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 ALERT/:ALERTTYPEID SUCCESSFUL RESPONSE TOGGLING SPECIFIC ALERT

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

PARAMETERS

Parameter Description Value
alertTypeId [required] alert4

REQUEST BODY

{
    "isEnabled": true
}

RESPONSE BODY

{
    "success": true
}