the payload is just an Object.

the difficult part is the Auth header.
This is my take from the (not so great docs).
NOTE: The URL and some other fields will need to be set up.
NOTE2: I have no idea if this will work but it should get you moving.
// MD5 the payload
const payload = JSON.stringify(msg.payload)
const md5Hash = crypto.createHash('md5').update(payload, 'utf8').digest();
const contentMD5 = md5Hash.toString('base64')
// extract other params or defaults
msg.method = msg.method || 'POST'
const canonicalResource = msg.canonicalResource || "/v1/api/inverterDetail"
const apiSecret = msg.secret || 'test-key'
const apiId = msg.apiId || 'your-api-id'
const contentType = 'application/json;charset=UTF-8' // fixed
// this might need some work - just hoping the UTC format works
const date = new Date().toUTCString()
// Generate the HMAC SHA-1 signature
const stringToSign = [
msg.method, // HTTP verb
contentMD5,
contentType,
date,
canonicalResource
].join('\n')
const hmac = crypto.createHmac('sha1', apiSecret)
hmac.update(stringToSign)
const signature = hmac.digest('base64')
// add auth header
msg.headers = msg.headers || {}
msg.headers.Authorization = `API ${apiId}:${signature}`
// set full URL
msg.url = `https://host/${canonicalResource}`
return msg;
example:
demo flow
[{"id":"097d84fb54289894","type":"function","z":"02d4291f2e0c055e","name":"apply auth header","func":"// MD5 the payload\nconst payload = JSON.stringify(msg.payload)\nconst md5Hash = crypto.createHash('md5').update(payload, 'utf8').digest();\nconst contentMD5 = md5Hash.toString('base64')\n\n// extract other params or defaults\nmsg.method = msg.method || 'POST'\nconst canonicalResource = msg.canonicalResource || \"/v1/api/inverterDetail\"\nconst apiSecret = msg.secret || 'test-key'\nconst apiId = msg.apiId || 'your-api-id'\nconst contentType = 'application/json;charset=UTF-8' // fixed\n\n// this might need some work - just hoping the UTC format works\nconst date = new Date().toUTCString()\n\n// Generate the HMAC SHA-1 signature\nconst stringToSign = [\n msg.method, // HTTP verb\n contentMD5,\n contentType,\n date,\n canonicalResource\n].join('\\n')\n\nconst hmac = crypto.createHmac('sha1', apiSecret)\nhmac.update(stringToSign)\nconst signature = hmac.digest('base64')\n\n// add auth header\nmsg.headers = msg.headers || {}\nmsg.headers.Authorization = `API ${apiId}:${signature}`\n\n// set full URL\nmsg.url = `https://host/${canonicalResource}`\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"crypto","module":"crypto"}],"x":560,"y":300,"wires":[["171900bd52625a4f","0bb9c7398219b913"]]},{"id":"1fa080ee367fed3e","type":"inject","z":"02d4291f2e0c055e","name":"test object id + sn","props":[{"p":"payload"},{"p":"method","v":"POST","vt":"str"},{"p":"canonicalResource","v":"/v1/api/inverterDetail","vt":"str"},{"p":"apiId","v":"my-api-id","vt":"str"},{"p":"secret","v":"my=secret","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"id\": \"1308675217944611083\", \"sn\": \"120B40198150131\" }","payloadType":"json","x":340,"y":300,"wires":[["097d84fb54289894"]]},{"id":"171900bd52625a4f","type":"http request","z":"02d4291f2e0c055e","d":true,"name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":790,"y":300,"wires":[["80adcc939017ae7d"]]},{"id":"0bb9c7398219b913","type":"debug","z":"02d4291f2e0c055e","name":"debug 199","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":240,"wires":[]},{"id":"80adcc939017ae7d","type":"debug","z":"02d4291f2e0c055e","name":"debug 198","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":300,"wires":[]}]
