JSON API » alerts » alerts/create
Creates a new alert.
Input parameters
Requires authentication and the administrator role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| name | String | Name. | Yes | |
| String | Email addresses to send alerts to. | Yes | ||
| type | String | What to alert on. "calls", "calls_start", "concurrent", "deregister", "destinations", "huntgroup_exit", "maximum", "registration_fail", "reregister", "numbers", "outgroups", "peer", "person_locked", "phone_address", "phone_locked", "phones", "queue_auto_unavailable", or "queue_exit". | Yes | |
| calls | Integer | The minimum number of calls to send an alert for "peer" type. | No | 1 |
| cost | Integer | The minimum cost to match, in the customer's currency. | No | 0.00 |
| customer | Integer | ID of customer to create in. | No | Customer of authentication user. |
| days_week | String | Which days the alert is active. Monday is 1, and Sunday is 7. "1,2,3,4,5" is Monday to Friday. | No | "1,2,3,4,5,6,7" |
| description | String | Description. | No | Empty string. |
| destination | String | The prefix of the destination to match. | No | Empty string. |
| dnd_seconds | Integer | Minimum length of time telephone line has been in do not disturb for in seconds. -1 for no limit. | No | -1 |
| endhour | Integer | The end hour, from 0 to 23. | No | 23 |
| endminute | Integer | The end minute, from 0 to 59. | No | 59 |
| endsecond | Integer | The end second, from 0 to 59. | No | 59 |
| events | Integer | 1 to record events for this alert, 0 not to. | No | 0 |
| idle_seconds | Integer | Minimum length of time telephone line has been idle for in seconds. -1 for no limit. | No | -1 |
| message | String | Destination to send text message to. | No | Empty string. |
| minimum_affected | Integer | The minimum number affected to send an alert. | No | 1 |
| minimum_calls | Integer | The minimum number of calls to send an alert for "outgroups" type. | No | 1 |
| minimum_duration | Integer | The minimum call duration affected to send an alert. | No | 1 |
| peer | Integer | The ID of the peer to check. | Only for "peer" type | 0 |
| percent_fail | Integer | The minimum percent of calls failing to send an alert. | No | 100 |
| period | Integer | The minimum interval to send alerts in seconds. | No | Current value. |
| search | Integer | 1 to use data from all customers on system, 0 not to. May only be used by system owners. | No | 0 |
| starthour | Integer | The start hour, from 0 to 23. | No | 0 |
| startminute | Integer | The start minute, from 0 to 59. | No | 0 |
| startsecond | Integer | The start second, from 0 to 59. | No | 0 |
| talktime | Integer | The minimum talk time to match in seconds. | No | 0 |
| times | Integer | The minimum number of times to match. | No | 1 |
| times_period | String | How long the times field applies to. "day", "week", or "month". | No | "day" |
| validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
For each type, only some of the matching fields are used. See the web interface to determine which.
Responses
| Code | Description |
|---|---|
| 200 | Success. |
| 201 | Input passed validation. Only returned if validation=1. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 403 | Your rate plan does not allow this. |
Data returned
The ID of the created alert.
Example: With required parameters
http://enswitch.example.com/api/json/alerts/create/?auth_username=user;auth_password=password;name=example1;email=user%40example.com;type=calls{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
| Version | Changes |
|---|---|
| 4.4 | reregister type added. |
| 4.2 | calls_start type added. |
| 3.15 | type input parameter changed to allow a value of "huntgroup_exit" and "registration_fail". |
| 3.14 | type input parameter changed to allow a value of "phone_address". |
| 3.13 | Function added. |
