Importing business data using API

Obtaining API authorization keys

Log into the Elven system, and navitage to the Entity for which you wish to integrate your business data using API. Click on the Ledger page, then locate an "Integrations" button at the upper right corner of your screen.

In the pop-up Integration management window, click on the "+Add new integration" button.

Set a desired label name for the new data type, and click the "Add" button.

Once the data type has been added, you can now add new data. Click the "Add data" button, and select "OpenAPI Integration" from the dropdown menu.

In the pop-up OpenAPI Integration window, click on the "Create" button.

In the next window, name the newly created API key.

Click on the "Create" button to finalize creation of the new API key.

You can click on the "Copy" icon next to each Key/Secret to copy it's content into your clipboard for use.

Authenticating API endpoint

Provide the following parameters in the Request header.

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

Generate the signature by concatenating the timestamp, request method, and path, then use the apisecret in a HMAC SHA256 encryption.

// 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')
  }

Sample outcome:

[
  '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
}

Uploading business data

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"},
       ]
}

Last updated