Skip to content

Notifications

The Notifications API allows for managing notifications, including fetching, creating, updating, and deleting notifications, as well as handling notification types and test notifications.

Data Schema

Field Type Description
id integer Notification ID
type string Notification type
always boolean Always send notification flag
web boolean Web notification enabled
mail boolean Email notification enabled
sms boolean SMS notification enabled
calendarId integer Associated calendar ID
attributes object Additional notification details

Fetch Notifications

Retrieves notifications based on specified filters and parameters.

🛠 Endpoint:

GET /notifications

Authorization:

  • Requires Basic Authentication (basicAuth)

Query Parameters:

Parameter Type Description
all boolean Admin/manager only: fetch all notifications
userId integer Filter notifications by user ID
deviceId integer Filter notifications by device ID
groupId integer Filter notifications by group ID
refresh boolean Refresh notification list

Example Request:

# Using Basic Auth
curl -u user:password -X GET 'http://itsochvts.com/api/notifications?userId=1'
# Using Cookie
curl -b 'JSESSIONID=your_session_id' -X GET 'http://itsochvts.com/api/notifications?userId=1'
200 OK - Response Body
[
  {
    "id": 0,
    "type": "string",
    "always": true,
    "web": true,
    "mail": true,
    "sms": true,
    "calendarId": 0,
    "attributes": {}
  }
]

Create Notification

Creates a new notification.

🛠 Endpoint:

POST /notifications

Authorization:

  • Requires Basic Authentication (basicAuth)

Example Request:

# Using Basic Auth
curl -u user:password -X POST 'http://itsochvts.com/api/notifications' \
  -H 'Content-Type: application/json' \
  -d '{"type":"alert","always":true,"web":true,"mail":false,"sms":true}'
# Using Cookie
curl -b 'JSESSIONID=your_session_id' -X POST 'http://itsochvts.com/api/notifications' \
  -H 'Content-Type: application/json' \
  -d '{"type":"alert","always":true,"web":true,"mail":false,"sms":true}'

Request Body:

{
  "id": 0,
  "type": "string",
  "always": true,
  "web": true,
  "mail": true,
  "sms": true,
  "calendarId": 0,
  "attributes": {}
}
200 OK - Response Body
{
  "id": 0,
  "type": "string",
  "always": true,
  "web": true,
  "mail": true,
  "sms": true,
  "calendarId": 0,
  "attributes": {}
}

Update Notification

Updates an existing notification.

🛠 Endpoint:

PUT /notifications/{id}

Authorization:

  • Requires Basic Authentication (basicAuth)

Path Parameters:

Parameter Type Description
id integer Notification ID

Example Request:

# Using Basic Auth
curl -u user:password -X PUT 'http://itsochvts.com/api/notifications/123' \
  -H 'Content-Type: application/json' \
  -d '{"type":"alert","always":true,"web":true,"mail":false,"sms":true}'
# Using Cookie
curl -b 'JSESSIONID=your_session_id' -X PUT 'http://itsochvts.com/api/notifications/123' \
  -H 'Content-Type: application/json' \
  -d '{"type":"alert","always":true,"web":true,"mail":false,"sms":true}'

Request Body:

{
  "id": 0,
  "type": "string",
  "always": true,
  "web": true,
  "mail": true,
  "sms": true,
  "calendarId": 0,
  "attributes": {}
}
200 OK - Response Body
{
  "id": 0,
  "type": "string",
  "always": true,
  "web": true,
  "mail": true,
  "sms": true,
  "calendarId": 0,
  "attributes": {}
}

Delete Notification

Deletes an existing notification.

🛠 Endpoint:

DELETE /notifications/{id}

Path Parameters:

Parameter Type Description
id integer Notification ID

Authorization:

  • Requires Basic Authentication (basicAuth)

Example Request:

# Using Basic Auth
curl -u user:password -X DELETE 'http://itsochvts.com/api/notifications/123'
# Using Cookie
curl -b 'JSESSIONID=your_session_id' -X DELETE 'http://itsochvts.com/api/notifications/123'
204 No Content

Get Notification Types

Fetches available notification types.

🛠 Endpoint:

GET /notifications/types

Authorization:

  • Requires Basic Authentication (basicAuth)
# Using Basic Auth
curl -u user:password -X GET 'http://itsochvts.com/api/notifications/types'

# Using Cookie
curl -b 'JSESSIONID=your_session_id' -X GET 'http://itsochvts.com/api/notifications/types'
200 OK - Response Body
[
  {
    "type": "string"
  }
]

Send Test Notification

Sends a test notification via email and SMS.

🛠 Endpoint:

POST /notifications/test

Authorization:

  • Requires Basic Authentication (basicAuth)

Example Request:

# Using Basic Auth
curl -u user:password -X POST 'http://itsochvts.com/api/notifications/test'
# Using HTTP Cookie
curl -b 'session-id=your-session-token' -X POST 'http://itsochvts.com/api/notifications/test'
204 Successful sending
400 Sending failed