5.4.3.15 Chaincode and block event query API
Use this API to query the list of monitored chaincode and block events that have been registered.
1. Interface address: https://PCNGatewayAddress/api/fabric/v1/chainCode/event/query
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 | N | |
3 | Signature Value | mac | String | Y | |
header | |||||
1 | user unique ID | userCode | String | Y | |
2 | DApp unique ID | appCode | String | Y |
Example:
{"header":{"appCode":"CL20191107112252","userCode":"lessing"},"body":{},"mac":"MEQCIAnJxvuKVe0u/bG0VYCjM3g3ctxTYIWkejYp462okNlcAiBcOTGvAkF7xErL2w1PiwgfFjIu3Sszgyfzym/pEwRGxA=="}
5. Response parameters
No. | Field name | Field | Type | Required | Remarks |
---|---|---|---|---|---|
1 | Header | header | Map | Y | |
2 | Body | body | []body | Y | Event List |
3 | Signature Value | mac | String | Y | |
Header | |||||
1 | Response ID | code | int | Y | 0: Query successful-1: Query failed |
2 | Response Message | msg | String | Y | |
body | |||||
1 | Event ID | eventId | String | Y | |
2 | Chaincode Event key | eventKey | String | N | Null if it’s a block event |
3 | Chaincode Event Notification URL | notifyUrl | String | Y | |
4 | Attached additional parameters | attachArgs | String | N | |
5 | Creation Time | createTime | String | Y | |
6 | PCN ID | orgCode | String | Y | |
7 | user unique ID | userCode | String | Y | |
8 | DApp unique code | appCode | String | Y | |
9 | Chaincode ID | chainCode | String | N | Null if it’s a block event |
10 | Event type | eventType | String | N | Returns “block” if it’s a block event; Null if it’s chaincode event |
Example:
{ "header": { "code": 0, "msg": "Query Event Successful" }, "body": [ { "eventKey": "test001", "notifyUrl": "http://192.168.6.128:8080/api/event/notifyUrl", "attachArgs": "a=123\u0026b=456", "eventId": "945ee631d26140118963ad3104c81713", "createTime": "2019-11-18 14:22:59", "orgCode": "ORG1571365934172", "userCode": "lessing", "appCode": "CL20191107112252", "chainCode": "cc_bsn_test_00" }, { "eventKey": "test002", "notifyUrl": "http://192.168.6.128:8080/api/event/notifyUrl", "attachArgs": "hahahhahhahahahah", "eventId": "346617a493d84c6d8512b8dddad87811", "createTime": "2019-11-18 14:29:28", "orgCode": "ORG1571365934172", "userCode": "lessing", "appCode": "CL20191107112252", "chainCode": "cc_bsn_test_00" }, { "eventKey": "test01", "notifyUrl": "http://192.168.6.128:8080/api/event/notifyUrl", "attachArgs": "name=Zhangsan\u0026age=20", "eventId": "bd3391deedbe44a7ad5b7f80ce59abfa", "createTime": "2019-11-19 10:52:15", "orgCode": "ORG1571365934172", "userCode": "lessing", "appCode": "CL20191107112252", "chainCode": "cc_bsn_test_00" } ], "mac": "MEQCIEYXFMa8dfBrjy/s9H5JAoFIrjROJBiw+7/daELUbF5eAiA7a6HvqqbOpv6vlkunHGxCB1o5DoeuJFD0FM6kLoU34Q=="}