Resource URL: /platform/<<version=3>>/event/channels

    Overview: This resource applies the standard collection pattern to channels.

     Methods: GET, POST

********************************************************************************

Method GET: List all channels.

       URL: GET /platform/<<version=3>>/event/channels

Query arguments:
  sort=<string> The field that will be used for sorting.
limit=<integer> Return no more than this many results at once (see resume).
     dir=<enum> Where <enum> is one of ASC, DESC.  The direction of the sort.
resume=<string> Continue returning results from previous call using this token
                (token should come from the previous call, resume cannot be
                used with other options).

GET response body schema:
{
  "type": [
    {
      "additionalProperties": false, 
      "type": "object", 
      "description": "A list of errors that may be returned.", 
      "properties": {
        "errors": {
          "items": {
            "additionalProperties": false, 
            "type": "object", 
            "description": "An object describing a single error.", 
            "properties": {
              "field": {
                "type": "string", 
                "description": "The field with the error if applicable."
              }, 
              "message": {
                "type": "string", 
                "description": "The error message."
              }, 
              "code": {
                "type": "string", 
                "description": "The error code."
              }
            }
          }, 
          "type": "array"
        }
      }
    }, 
    {
      "additionalProperties": false, 
      "type": "object", 
      "properties": {
        "channels": {
          "minItems": 0, 
          "items": {
            "type": "object", 
            "description": "Named channel through which alerts can be delivered.", 
            "properties": {
              "name": {
                "type": "string", 
                "description": "Channel name,  may not contain /, max length 254."
              }, 
              "parameters": {
                "type": [
                  {
                    "type": "object", 
                    "description": "Parameters to be used for an smtp channel", 
                    "properties": {
                      "smtp_use_auth": {
                        "type": "boolean", 
                        "description": "Use SMTP authentication - optional defaulst to false."
                      }, 
                      "smtp_password": {
                        "type": "string", 
                        "description": "Password for SMTP authentication - only if smtp_use_auth true."
                      }, 
                      "smtp_port": {
                        "type": "integer", 
                        "description": "SMTP relay port - optional defaults to 25."
                      }, 
                      "smtp_host": {
                        "type": "string", 
                        "description": "SMTP relay host."
                      }, 
                      "custom_template": {
                        "type": "string", 
                        "description": "Path to custom notification template."
                      }, 
                      "batch": {
                        "enum": [
                          "NONE", 
                          "ALL", 
                          "CATEGORY", 
                          "SEVERITY"
                        ], 
                        "type": "string", 
                        "description": "Batching criterion."
                      }, 
                      "batch_period": {
                        "type": "integer", 
                        "description": "Period over which batching is to be performed."
                      }, 
                      "send_as": {
                        "type": "string", 
                        "description": "Email address to use as from."
                      }, 
                      "smtp_security": {
                        "enum": [
                          "NONE", 
                          "STARTTLS"
                        ], 
                        "type": "string", 
                        "description": "Encryption protocol to use for SMTP."
                      }, 
                      "address": {
                        "items": {
                          "type": "string"
                        }, 
                        "type": "array", 
                        "description": "Email addresses to send to."
                      }, 
                      "smtp_username": {
                        "type": "string", 
                        "description": "Username for SMTP authentication - only if smtp_use_auth true."
                      }, 
                      "subject": {
                        "type": "string", 
                        "description": "Subject for emails."
                      }
                    }
                  }, 
                  {
                    "type": "object", 
                    "description": "Parameters to be used for an snmp channel", 
                    "properties": {
                      "host": {
                        "type": "string", 
                        "description": "Destination for SNMP trap."
                      }, 
                      "community": {
                        "type": "string", 
                        "description": "Optional defaults to 'public'."
                      }, 
                      "use_snmp_trap": {
                        "type": "boolean", 
                        "description": "Use snmptrap instead of snmpinform."
                      }
                    }
                  }
                ], 
                "description": "A collection of parameters dependent on the channel type"
              }, 
              "allowed_nodes": {
                "items": {
                  "type": "integer"
                }, 
                "type": "array", 
                "description": "Nodes (LNNs) that can be masters for this channel"
              }, 
              "enabled": {
                "type": "boolean", 
                "description": "Channel is to be used or not"
              }, 
              "system": {
                "type": "boolean", 
                "description": "Channel is a pre-defined system channel"
              }, 
              "excluded_nodes": {
                "items": {
                  "type": "integer"
                }, 
                "type": "array", 
                "description": "Nodes (LNNs) that can NOT be the masters for this channel"
              }, 
              "type": {
                "enum": [
                  "connectemc", 
                  "smtp", 
                  "snmp", 
                  "heartbeat"
                ], 
                "type": "string", 
                "description": "The mechanism used by the channel"
              }, 
              "id": {
                "type": "integer", 
                "description": "Unique identifier."
              }
            }
          }, 
          "type": "array", 
          "maxItems": 4294967295
        }, 
        "total": {
          "minimum": 0, 
          "type": "integer", 
          "description": "Total number of items available.", 
          "maximum": 4294967295
        }, 
        "resume": {
          "minLength": 0, 
          "type": [
            "string", 
            "null"
          ], 
          "description": "Continue returning results from previous call using this token (token should come from the previous call, resume cannot be used with other options)."
        }
      }
    }
  ]
}

********************************************************************************

Method POST: Create a new channel.

        URL: POST /platform/<<version=3>>/event/channels

There are no query arguments for this method.

Required POST request body fields:
name, type

POST request body schema:
{
  "type": "object", 
  "description": "Named channel through which alerts can be delivered.", 
  "properties": {
    "name": {
      "required": true, 
      "type": "string", 
      "description": "Channel name,  may not contain /, max length 254."
    }, 
    "parameters": {
      "type": [
        {
          "type": "object", 
          "description": "Parameters to be used for an smtp channel", 
          "properties": {
            "smtp_use_auth": {
              "type": "boolean", 
              "description": "Use SMTP authentication - optional defaulst to false."
            }, 
            "smtp_password": {
              "type": "string", 
              "description": "Password for SMTP authentication - only if smtp_use_auth true."
            }, 
            "smtp_port": {
              "type": "integer", 
              "description": "SMTP relay port - optional defaults to 25."
            }, 
            "smtp_host": {
              "type": "string", 
              "description": "SMTP relay host."
            }, 
            "custom_template": {
              "type": "string", 
              "description": "Path to custom notification template."
            }, 
            "batch": {
              "enum": [
                "NONE", 
                "ALL", 
                "CATEGORY", 
                "SEVERITY"
              ], 
              "type": "string", 
              "description": "Batching criterion."
            }, 
            "batch_period": {
              "type": "integer", 
              "description": "Period over which batching is to be performed."
            }, 
            "send_as": {
              "type": "string", 
              "description": "Email address to use as from."
            }, 
            "smtp_security": {
              "enum": [
                "NONE", 
                "STARTTLS"
              ], 
              "type": "string", 
              "description": "Encryption protocol to use for SMTP."
            }, 
            "address": {
              "items": {
                "type": "string"
              }, 
              "type": "array", 
              "description": "Email addresses to send to."
            }, 
            "smtp_username": {
              "type": "string", 
              "description": "Username for SMTP authentication - only if smtp_use_auth true."
            }, 
            "subject": {
              "type": "string", 
              "description": "Subject for emails."
            }
          }
        }, 
        {
          "type": "object", 
          "description": "Parameters to be used for an snmp channel", 
          "properties": {
            "host": {
              "type": "string", 
              "description": "Destination for SNMP trap."
            }, 
            "community": {
              "type": "string", 
              "description": "Optional defaults to 'public'."
            }, 
            "use_snmp_trap": {
              "type": "boolean", 
              "description": "Use snmptrap instead of snmpinform."
            }
          }
        }
      ], 
      "description": "A collection of parameters dependent on the channel type"
    }, 
    "allowed_nodes": {
      "items": {
        "type": "integer"
      }, 
      "type": "array", 
      "description": "Nodes (LNNs) that can be masters for this channel"
    }, 
    "enabled": {
      "type": "boolean", 
      "description": "Channel is to be used or not"
    }, 
    "system": {
      "type": "boolean", 
      "description": "Channel is a pre-defined system channel"
    }, 
    "excluded_nodes": {
      "items": {
        "type": "integer"
      }, 
      "type": "array", 
      "description": "Nodes (LNNs) that can NOT be the masters for this channel"
    }, 
    "type": {
      "enum": [
        "connectemc", 
        "smtp", 
        "snmp", 
        "heartbeat"
      ], 
      "type": "string", 
      "description": "The mechanism used by the channel", 
      "required": true
    }, 
    "id": {
      "type": "integer", 
      "description": "Unique identifier."
    }
  }
}

POST response body schema:
{
  "type": [
    {
      "additionalProperties": false, 
      "type": "object", 
      "description": "A list of errors that may be returned.", 
      "properties": {
        "errors": {
          "items": {
            "additionalProperties": false, 
            "type": "object", 
            "description": "An object describing a single error.", 
            "properties": {
              "field": {
                "type": "string", 
                "description": "The field with the error if applicable."
              }, 
              "message": {
                "type": "string", 
                "description": "The error message."
              }, 
              "code": {
                "type": "string", 
                "description": "The error code."
              }
            }
          }, 
          "type": "array"
        }
      }
    }, 
    {
      "type": "object", 
      "properties": {
        "id": {
          "minLength": 0, 
          "required": true, 
          "type": "string", 
          "description": "ID of created item that can be used to refer to item in the collection-item resource path.", 
          "maxLength": 255
        }
      }
    }
  ]
}
