POST – Create a subscription
Create a subscription for Redfish service to send event to subscriber.
Request URL
POST https://<BMC_IPADDR>/redfish/v1/EventService/Subscriptions
Request body
| Field | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
Destination  | String | This property shall contain a URI to the destination where the events will be sent.  | ||||||
Context  | String | A client-supplied string that is stored with the event destination subscription.  | ||||||
Protocol  | String | “Redfish”  | ||||||
RegistryPrefixes  | Array | Item: string Item count: maps to members under the resource /redfish/v1/Registries  | ||||||
RegistryPrefixes[N]  | String | Maps to members under the resource /redfish/v1/Registries  | ||||||
Response body
It responds the created subscription resource, refer the response body of Event subscription with GET method.
Status code
| HTTP Status Code | Error Message ID | 
|---|---|
| 201 | Created | 
| 400 | BadRequest, PropertyValueNotInList | 
| 500 | InternalError | 
Example
Create Redfish protocol subscription
{
    "Protocol": "Redfish",
    "Context": "Test_Context",
    "Destination": "https://192.168.0.2:443",
    "RegistryPrefixes": [
        "EventRegistry"
    ]
}
The following example JSON response is returned:
{
   "SubscriptionType" : "RedfishEvent",
   "HttpHeaders" : [],
   "RegistryPrefixes" : [
      "EventRegistry"
   ],
   "EventFormatType" : "Event",
   "OriginResources@odata.count" : 0,
   "OriginResources" : [],
   "Id" : "3A048D0E",
   "Destination" : "https://192.168.0.2:443",
   "Context" : "Test_Context",
   "MessageIds" : [],
   "SubordinateResources" : null,
   "@odata.id" : "/redfish/v1/EventService/Subscriptions/3A048D0E",
   "@odata.etag" : "\"1575571584025\"",
   "@odata.type" : "#EventDestination.v1_5_0.EventDestination",
   "Protocol" : "Redfish",
   "Description" : "This resource represents the target of an event subscription, including the types of events subscribed and context to provide to the target in the Event payload.",
   "Name" : "Destination",
   "ResourceTypes" : []
}
Create SMTP protocol subscription
{
    “Context”: “SMTP user”,
    "Destination": "mailto:userid@lenovo.com",
    "Protocol": "SMTP"
}
{
    "Protocol": "SMTP",
    "Description": "This resource represents an event destination for a Redfish implementation.",
    "EventFormatType": "Event",
    "Id": "REST-SMTP-1",
    "Status": {
        "State": "Enabled"
    },
    "Context": "SMTP user",
    "@odata.type": "#EventDestination.v1_11_0.EventDestination",
    "@odata.id": "/redfish/v1/EventService/Subscriptions/REST-SMTP-1",
    "@odata.etag": "\"363737e9a52729657ae\"",
    "Name": "REST-SMTP-1",
    "Destination": "mailto:userid@lenovo.com",
    "SubscriptionType": "RedfishEvent"
}
Create SNMPv1 trap subscription
{
    "Destination": "snmp://10.10.10.10",
    "Protocol": "SNMPv1",
     "SNMP": {
        "TrapCommunity": "test"
    }
}
{
    "Protocol": "SNMPv1",
    "Id": "REST-SNMPv1-1",
    "SNMP": {
        "TrapCommunity": "test"
    },
    "@odata.type": "#EventDestination.v1_8_0.EventDestination",
    "@odata.id": "/redfish/v1/EventService/Subscriptions/REST-SNMPv1-1",
    "Destination": "snmp://10.10.10.10",
    "Description": "This resource represents an event destination for a Redfish implementation.",
    "Context": "",
    "Name": "REST-SNMPv1-1",
    "Status": {
        "State": "Disabled"
    },
    "@odata.etag": "\"38906ed3cd672966db8\"",
    "SubscriptionType": "SNMPTrap",
    "EventFormatType": "Event"
}
Note that if the “State” in the response is “Disabled”, you would need to enable the SNMPv1 trap in /redfish/v1/Managers/1/NetworkProtocol /Oem/Lenovo/SNMP.
Create SNMPv2c trap subscription
{
    "Protocol": "SNMPv2c",
   "Destination": "snmp://10.10.10.11",
"SNMP": {
        "TrapCommunity": "TestTrapCommunity"
    }
}
{
  "SubscriptionType": "SNMPTrap",
    "Description": "This resource represents an event destination for a Redfish implementation.",
    "Destination": "snmp://10.10.10.11",
    "Context": "",
    "Status": {
        "State": "Enabled"
    },
    "EventFormatType": "Event",
    "Id": "REST-SNMPv2c-1",
    "Name": "REST-SNMPv2c-1",
    "@odata.type": "#EventDestination.v1_11_2.EventDestination",
    "@odata.id": "/redfish/v1/EventService/Subscriptions/REST-SNMPv2c-1",
    "Protocol": "SNMPv2c",
    "@odata.etag": "\"3dd4bf8b4ce72a26dff\"",
    "@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
    "SNMP": {
        "TrapCommunity": "TestTrapCommunity"
    }
}
Note that only one SNMPv1 and one SNMPv2c can be created.
Create SNMPv3 trap subscription
{
    "Destination": "snmp://test@10.10.10.10",
    "Protocol": "SNMPv3"
}
{
    "Protocol": "SNMPv3",
    "Id": "REST-SNMPv3-2",
    "SubscriptionType": "SNMPTrap",
    "@odata.type": "#EventDestination.v1_8_0.EventDestination",
    "@odata.id": "/redfish/v1/EventService/Subscriptions/REST-SNMPv3-2",
    "Destination": "snmp://test@10.10.10.10",
    "Description": "This resource represents an event destination for a Redfish implementation.",
    "Context": "",
    "Name": "test",
    "Status": {
        "State": "Disabled"
    },
    "SNMP": {
        "TrapCommunity": null
    },
    "@odata.etag": "\"3b17f6a279c82667a00\"",
    "EventFormatType": "Event"
}
Note that if the “State” in the response is “Disabled”, you would need to enable the SNMPv3 trap in /redfish/v1/Managers/1/NetworkProtocol /Oem/Lenovo/SNMP. Refer to SNMP Management