Generate a Merkle Hash
This endpoint accepts an input object containing data and alerts, processes it, and returns a calculated Merkle hash.
URL : /merkle-hash
Method : POST
X-HMAC required : YES
Request Body Parameters : Base Input Object
Response
The response will be a JSON object containing the calculated Merkle root hash, layers and the data itself (see Base Input Object).
interface Response {
root: string
layers: string[][]
data: BinMesurement[]
}
Status Codes
The endpoint will return the following status codes based on the operation outcome:
- 200
OK: The request was successful, and the Merkle hash was calculated. - 400
Bad Request: The request was invalid. This usually occurs if the request body is not properly formatted. - 500
Internal Server Error: An error occurred on the server while processing the request.
Example Request
POST /merkle-hash HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Content-Length: 303
{
"data": [
{
"bin": "521739b1-5f51-4245-b80b-e45465925347",
"data": {
"vlt": 1,
"amp": 2,
"tmp": 3,
"ts": "2024-01-25T10:00:00Z"
},
"alerts": [
{
"code": "SE001001",
"ts": "2024-01-25T10:00:00Z"
}
]
}
]
}
Example Response
{
"root": "9188efa5ada444488996773ec063cc5ffd909d6046a2bfb2a55c3d1e5e123aac",
"layers": [
[
"9188efa5ada444488996773ec063cc5ffd909d6046a2bfb2a55c3d1e5e123aac"
]
],
"data": [
{
"bin": "521739b1-5f51-4245-b80b-e45465925347",
"data": {
"vlt": 1,
"amp": 2,
"tmp": 3,
"ts": "data_timestamp"
},
"alerts": [
{
"code": "SE001001",
"ts": "data_timestamp"
}
]
}
]
}
Table of Contents
