Skip to main content

Data API

Overview

This document introduces the integration details for DATA development.

Data API Authentication Login

All interface services (RESTful style HTTP services) published by the platform require authentication login to ensure data security. Currently, only one authentication method is supported: Bearer Token.

Integration Preparation

You need to obtain a pair of client_id and client_secret from the platform. This is the unique identifier for your application, used to obtain the access_token.

Authentication

Once you have the client_id and client_secret, you can obtain the access_token by following these steps:

Step 1: Generate Signature

Signature generation rule: client_id + current timestamp + client_secret, then perform MD5 encryption. The resulting 32-character uppercase string is the signature string.

  • Example of signature generation:

      <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
    <script>
    const client = "输入你的 client_id"
    const secret = "输入你的 client_secret"
    const timestamp = Math.ceil(+new Date() / 1000) // 当前时间戳(十位)
    const plaintext = `${client}${timestamp}${secret}` // 签名明文
    const signature = CryptoJS.MD5(plaintext).toString().toUpperCase(); // 得到签名

    console.log(`签名结果:${signature}`)
    </script>

Step 2: Send Authentication Request

  • Request method: POST

  • Content-Type: application/json

  • Request parameters:

    Parameter NameTypeRequiredDescription
    clientIdstringYesClient (provided by the platform)
    timenumberYesCurrent timestamp
    signaturestringYesSignature (generated by client_id + time + client_secret, then MD5 encrypted to a 32-char uppercase string)
  • Request example:

    curl --location 'https://localhost/api/TokenAuth/Authenticate' \
    --header 'Content-Type: application/json' \
    --data '{
    "clientId": "openapi",
    "time": 1724753509317,
    "signature": "B9DBA02F6223468F16E8250D8F080CFF"
    }'
  • Response parameters:

    Parameter NameSub-parameterDescription
    codeStatus code
    dataResult data
    accessTokenAccess token
    expireInSecondsValid time (seconds)
    successWhether successful
    msgError message
  • Response example:

    {
    "code": 200,
    "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0V4dGVybmFsIjpmYWxzZSwidXNlcklkIjoiNDMyNDMwMDg0OTY4Njc3Nzg1NyIsImFjY291bnQiOiJXZWxsaW5ndG9uQXBpIiwicmVhbE5hbWUiOiJXZWxsaW5ndG9uQXBpIiwidXNlclR5cGUiOiJkZGFfY2xpZW50Iiwic3lzdGVtIjoiSE9NRSIsImVtYWlsIjpudWxsLCJhdmF0YXIiOm51bGwsImdsb2JlUm9sZU5hbWUiOm51bGwsImNsaWVudFR5cGUiOjAsIm11c3RDaGFuZ2VQd2QiOmZhbHNlLCJleHAiOjE3Mjg4MDcyMDV9.J0oiH0hzYv72X65DZEOoAxDV6PsNuUuyKhNYkdlaD90",
    "expireInSeconds": 86400
    },
    "success": true,
    "msg": null
    }