SSE subscription
Create a subscription of Server-Sent Events for Redfish service to send event to client and keep the connection open.
Request URL
POST https://<BMC_IPADDR>/{ServerSentEventUri}
ServerSentEventUri: as specified in ServerSentEventUri property of EventService.
Request body
None
Response body
None
Status code
None
Example
Subscribe SSE events - curl
$ curl "https://192.168.0.1/redfish/v1/EventService/ServerSentEvent" -X GET -k -u USERID:PASSW0RD
Subscribe SSE events - browser
Use a web browser (e.g. Chrome) to access URI of https://192.168.0.1/redfish/v1/EventService/ServerSentEvent, and you will see browser displays the received events.
Event JSON data response
The following example JSON response is returned.
…
…
: stream keep-alive
id:2
data:{
data:    "Events@odata.count": 1,
data:    "Id": "2",
data:    "Events": [
data:        {
data:            "MessageArgs": [
data:                "USERID",
data:                "the standard password",
data:                "web",
data:                "192.168.0.2"
data:            ],
data:            "Message": "Remote Login Successful. Login ID: USERID using the standard password from web at IP address 192.168.0.2.",
data:            "EventGroupId": 0,
data:            "Oem": {
data:                "SystemSerialNumber": "DSYM09X",
data:                "Lenovo": {
data:                    "ReportingChain": "",
data:                    "IsLocalEvent": true,
data:                    "RawDebugLogURL": "",
data:                    "AffectedIndicatorLEDs": [
data:                    ],
data:                    "EventFlag": 0,
data:                    "AuxiliaryData": "",
data:                    "Source": "System",
data:                    "FailingFRU": [
data:                        {
data:                            "FRUSerialNumber": "",
data:                            "FRUNumber": ""
data:                        }
data:                    ],
data:                    "TSLVersion": "0",
data:                    "RelatedEventID": "",
data:                    "Hidden": false,
data:                    "EventID": "0x4000000e00000000",
data:                    "EventSequenceNumber": 1616,
data:                    "EventType": 0,
data:                    "@odata.type": "#LenovoLogEntry.v1_0_0.StandardLogEntry",
data:                    "LenovoMessageID": "Lenovo0014",
data:                    "TotalSequenceNumber": 1965,
data:                    "CommonEventID": "FQXSPSE4001I",
data:                    "Serviceable": "Not Serviceable"
data:                },
data:                "SystemMachineTypeModel": "7X05CTO1WW",
data:                "SystemUUID": "F0F63E94-8E25-11E8-9A5A-7ED30A5E2267"
data:            },
data:            "EventId": "16ED786F53C",
data:            "MemberId": "0001",
data:            "MessageId": "EventRegistry.1.0.FQXSPSE4001I",
data:            "MessageSeverity": "OK",
data:            "OriginOfCondition": {
data:                "@odata.id": "/redfish/v1/Systems/1/LogServices/StandardLog"
data:            },
data:            "EventTimestamp": "2019-12-05T19:26:16+00:00"
data:        }
data:    ],
data:    "@odata.type": "#Event.v1_4_0.Event",
data:    "Name": "Redfish Event",
data:    "Description": "This resource represents an event for a Redfish implementation."
data:}
: stream keep-alive
: stream keep-alive
…
…
Query SSE event subscription
GET https://192.168.0.1/redfish/v1/EventService/Subscriptions, and find the new subscription of SSE is in the collection.
In the example it is “/redfish/v1/EventService/Subscriptions/C8ECC924”.
{
    "Members": [
        {
            "@odata.id": "/redfish/v1/EventService/Subscriptions/C8ECC924"
        }
    ],
    "@odata.type": "#EventDestinationCollection.EventDestinationCollection",
    "@odata.id": "/redfish/v1/EventService/Subscriptions",
    "Members@odata.count": 1,
    "@odata.etag": "\"1554741700566\"",
    "Name": "Subscriptions",
    "@odata.context": "/redfish/v1/$metadata#EventDestinationCollection.EventDestinationCollection"
}
GET https://192.168.0.1/redfish/v1/EventService/Subscriptions/C8ECC924, and find the subscription properties.
{
    "HttpHeaders": [],
    "Id": "C8ECC924",
    "SubordinateResources": null,
    "Context": null,
    "MessageIds": [],
    "SubscriptionType": "SSE",
    "ResourceTypes": [],
    "OriginResources@odata.count": 0,
    "Protocol": "Redfish",
    "Name": "Destination",
    "RegistryPrefixes": [],
    "@odata.type": "#EventDestination.v1_5_0.EventDestination",
    "@odata.id": "/redfish/v1/EventService/Subscriptions/C8ECC924",
    "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.",
    "@odata.etag": "\"1575573946737\"",
    "OriginResources": [],
    "EventFormatType": "Event"
}
Note: the “SubscriptionType” property value is “SSE”, that means an SSE subscription.