5.4.3.12 Get the latest ledger information API
Use this interface to get the latest ledger information, including block hash, previous block hash, and the current block height, etc.
1. Interface address: https://PCNGatewayAddress/api/fabric/v1/node/getLedgerInfo
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 | 
Example:
{"header":{"userCode":"USER0001202004151958010871292","appCode":"app0001202004161020152918451","tId":""},"mac":"MEQCID7Z3J2PiRDOx7JasRamBZRTAHXj1XAG1K/DUkzJEwuiAiBIY5p3H2kArE7OuYLOgEqMHl15Xgj5Voi5zVPGhyU/+w==","body":{}}
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: authentication successful -1: authentication failed | 
| 2 | Response Message | msg | String | N | if code=0 then can be null | 
| Body | |||||
| 1 | Block Hash | blockHash | String | Y | |
| 2 | Block Height | height | Long | Y | |
| 3 | Previous Block Hash | preBlockHash | String | Y | 
Example:
{
  "header": {
    "code": 0,
    "msg": "Transaction Successful"
  },
  "mac": "MEUCIQC4PhYTBNyt1rSeBeZTdOly42CxILVgK1b/RlieA33G1gIgeodoEa5Ou0X4uWc/VGp0n6NKByhXlBbo22FME4xQ8aw=",
  "body": {
    "blockHash": "ab9366cf63881228863c884527fceefabc9ad2e375aa0bcbf71f17f75c7d3ff5",
    "height": 8,
    "preBlockHash": "fc83c306677925efee540b4d7b7ca73e06f144cae34c706f1101d6b395ada2da"
  }
}