Importing business data using API
Last updated
Last updated
elven-api-key The obtained apiKey
elven-api-sign Signature in base64 format, e.g. LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=
elven-api-timestamp Timestamp in milliseconds, e.g. 1721209655047, expiry is 30seconds// crypto uses https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js 库
/**
* Generate signature
* apiSecret: BjGiqCWfHGCrl065dlEBWFO5vLj7Hqiexxx,
* timestamp: 1721205912758
* method POST
* path /open/v3/businessData
*/
buildSign(apiSecret: string, timestamp: number, method: string, path: string) {
const str = `${timestamp}${method}${path}`
return crypto.createHmac('sha256', apiSecret).update(str).digest('base64')
}
[
'D7JLJ3awwrTdNXtSrPI1GlYE', // key
'BjGiqCWfHGCrl065dlEBWFO5vLj7Hqie', // secret
'POST', // method in CAPS
'/open/v3/businessData' // not including domain, only the path starting with /
]
{
'elven-api-key': 'D7JLJ3awwrTdNXtSrPI1GlYE',
'elven-api-sign': 'LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=',
'elven-api-timestamp': 1721209655047
}POST https://openapi.elven.com/open/v3/businessData
header
{
elven-api-key: aaaa
elven-api-sign: bbbbbbbbbbbb
elven-api-timestamp: 22222222
}
body
{
businessDataTypeName: 'Settlement', // Data type that has been created
businessDataSourceName: 'Settlement-2024-07',// For OpenAPI types that has not been created.
businessDataList: [
{"a": 100, "b": "buy", "c": "2024-07-01 22:33:44"},
{"a": 100, "b": "sell", "c": "2024-07-01 23:33:44"},
{"a": 100, "b": "buy", "c": "2024-07-02 06:33:44"},
]
}