5.4.3.13 Chaincode event registration API
Chaincode event in a DApp can trigger the off-BSN system to process further transactions. This interface is used to register the chaincode event to be monitored.
1. Interface address: https://PCNGatewayAddress/api/fabric/v1/chainCode/event/register
2. Call method: POST
3. Signature algorithm: required and refer to Section 5.4.3.1
4. Call parameters
No. | Field name | Field | Type | Required | Remarks |
---|---|---|---|---|---|
1 | Header | header | Map | Y | |
2 | Body | body | Map | Y | |
3 | Signature Value | mac | String | Y | |
Header | |||||
1 | user unique ID | userCode | String | Y | |
2 | DApp unique ID | appCode | String | Y | |
Body | |||||
1 | ChainCode | chainCode | String | Y | |
2 | Chaincode event key | eventKey | String | Y | |
3 | Chaincode event notification URL | notifyUrl | String | Y | URL to receive the monitored chaincode event |
4 | Attached additional parameters | attachArgs | String | N |
Example:
{"header":{"appCode":"CL20191107112252","userCode":"lessing"},"body":{"attachArgs":"name=TOM&age=20","chainCode":"cc_bsn_test_00","eventKey":"test01","notifyUrl":"http://192.168.6.128:8080/api/event/notifyUrl"},"mac":"MEUCIQCjzPr4KZVild2Vm5YgcunOXTh9mQK2QfWcRnYCk+jOzgIgDW6oHca7/249M43p2ElwiMNbuejdwAnyW5OwiMqiWCQ="}
5. Response parameters
No. | Field name | Field | Type | Required | Remarks |
---|---|---|---|---|---|
1 | Header | header | Map | Y | |
2 | Body | body | Map | Y | |
3 | Signature Value | mac | String | Y | |
header | |||||
1 | Response ID | code | int | Y | 0: successful -1: failed |
2 | Response Message | msg | String | Y | |
Body | |||||
1 | Event ID | eventId | String | Y |
Example:
{ "header": { "code": 0, "msg": "Event Registration Successful" }, "body": { "eventId": "bd3391deedbe44a7ad5b7f80ce59abfa" }, "mac": "MEQCIENLpj2R9mRL100vcMXs0X5rwfSjB/U7kMg+76GjEPNJAiBlUo/Eyj49uXTPrzRW0m4rJ0NQIkZnDMPbyalxojXwrA=="}