Skip to main content

Data API

Overview

This document introduces relevant content for DATA development integration.

Data Interface Authentication Login

All external 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, which serves as the unique identifier for your application to obtain an access token.

Identity Authentication

Once you have the client_id and client_secret, you can obtain the access token through the following steps:

Step 1: Generate Signature

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

  • Signature generation example:

      <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
    <script>
    const client = "Enter your client_id"
    const secret = "Enter your client_secret"
    const timestamp = Math.ceil(+new Date() / 1000) // Current timestamp (ten digits)
    const plaintext = `${client}${timestamp}${secret}` // Plaintext for signature
    const signature = CryptoJS.MD5(plaintext).toString().toUpperCase(); // Obtained signature

    console.log(`Signature result: ${signature}`)
    </script>

Step 2: Send Authentication Request

  • Request Method: POST

  • Content-Type: application/json

  • Request Parameters:

    ParameterTypeRequiredDescription
    clientIdStringYesClient (provided by platform)
    timeNumberYesCurrent timestamp
    signatureStringYesSignature (Generated by client_id + time + client_secret, then MD5 encryption. The 32-character uppercase encrypted string is the signature)
  • Request Example:

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

    ParameterSub-ParameterDescription
    codeStatus code
    dataResult data
    accessTokenAccess token
    expireInSecondsValidity period (seconds)
    successWhether successful
    msgError message
  • Response Example:

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