Events can be subscribed to via a REST proxy or HLF SDKs. The following is the procedure to subscribe via a REST proxy:
- REST endpoint: <host name>:<port>/<REST proxy>/bcsgw/rest/v1/event/subscribe
- REST method: POST
- Headers:
- Content-Type: application/json
- Authorization: <Basic authorization>
- Accept-Charset: UTF-8:
- The JSON input to be passed to the REST API:
{
"requests":[
{
"eventType":"chaincodeEvent",
"callbackURL": "--- call back webhook url---",
"callbackTlsCerts":{
"caCert":" -- mandatory field which is the callback server's CA certificate in PEM format. It will be verified by REST proxy",
"clientCert": "--Optional field which refers to the REST proxy certificate should use during callback --",
"keyPassword": "--clientCert's encrypted private key in base64 encoded"
},
"expires": "1m",
"channel": "channeleducation",
"chaincode": "cceducation",
"eventName": "testEvent"
}
]
}
- It responds with subid.