# com.innovaphone.events (App API)

This API provides an interface for sending logs and events to the Events App Service.

## API model

### Service info

The API doesn't define any service info.

### Provider model

The API doesn't define a provider model.

## API messages

All messages are JSON objects that have a mandatory attribute "mt" that specifies the message type.

### Requests

AddEvent
  Used to add a new event.
  type
    It should be "error" to add a new event
  severity
    It can be Minor (0), Indeterminate (1) or Major (2)
  code
    Unique code number for this event
  date
    The timestamp in seconds
  host
    The host
  serial
    The MAC address of the device
  source
    Indicates software module, which sent the corresponding event
  text
    A short description of the corresponding event
  xsl
    Name of the template to parse the details
  details
    XML data to be parsed using the xsl template
  Example: `{ mt: "AddEvent", type: "error", severity: 1, code: "0x0011005b", date: "1580559884", host: "IP0011-00-00-00", serial: "009033000000", source: "IP", text: "No route to destination", xsl: "fault_network.xsl", details: "<route src-addr=\"10.0.0.1\" src-port=\"24\" dst-addr=\"10.0.0.3\" dst-port=\"80\" prot=\"TCP\" cause=\"Destination interface down\"/>" }`

AddAlarm
  Used to add a new alarm or clear an existing one.
  type
    It could be "alarm" to set a new alarm or "clear" to clear an existing alarm
  severity
    It can be Minor (0), Indeterminate (1) or Major (2)
  active
    It should be true if the alarm is still active and false in other case
  code
    Unique code number for this alarm
  date
    The timestamp in seconds
  host
    The host
  serial
    The MAC address of the device
  source
    Indicates software module, which sent the corresponding alarm
  text
    A short description of the corresponding alarm
  xsl
    Name of the template to parse the details
  details
    XML data to be parsed using the xsl template
  Example: `{ mt: "AddAlarm", type: "alarm", severity: 1, active: true, code: "0x00010002", date: "1580559884", host: "IP0011-42-04-a7", serial: "009033000000", source: "RELAY/RECH", text: "Registration down", xsl: "fault_relay.xsl", details: "<relay prot=\"SH323\"/>" }`

AddLog
  Used to add a new log.
  time
    The timestamp in seconds
  date
    The date of the log with the format YYYYMMDD-HHmmss
  from
    The host
  serial
    The MAC address of the device
  msg
    The log message
  Example: `{ mt: "AddLog", time: "1580559884", date: "20200302-101125", from: "IP811-00-00-00", serial: "009033000000", msg: "This is the log info" }`

### Responses

AddEventResult
  One single AddEventResult is returned for each AddEvent request
  result
    "ok" if the event could be added and "failed" in other case
  Example: `{ mt: "AddEventResult", result :"ok" }`
AddAlarmResult
  One single AddAlarmResult is returned for each AddAlarm request
  result
    "ok" if the alarm could be added and "failed" in other case
  Example: `{ mt: "AddAlarmResult", result :"ok" }`
AddLogResult
  One single AddLogResult is returned for each AddLog request
  result
    "ok" if the log could be added and "failed" in other case
  Example: `{ mt: "AddLogResult", result :"ok" }`