Skip to main content

Partner API Reference


📘 Overview

This document describes the Partner Open API, which allows external developers to integrate with the glucose device platform. Main features:
  • User registration and authentication
  • User glucose data query
  • Device information query
  • Device glucose data query
All APIs use HTTPS and exchange data in JSON format.

🌐 API Endpoint

https://test-api.dreisamtech.com

🔐 Authentication

All APIs (except user registration) require an access token.
Authorization: Bearer {access_token}
The access token is obtained from:
  • User registration API
  • Get user token API

📦 Common Response Format

{
  "code": 0,
  "msg": "ok",
  "data": {}
}
FieldTypeDescription
codeint0 indicates success
msgstringBusiness message
dataobjectResponse payload

Common Error Codes

CodeDescription
0Success
1001Unauthorized / token invalid
1002Permission denied

⏱ Time Format

All time fields are represented as:
Unix timestamp in milliseconds
Example:
1700000000000

👤 User APIs


1. Register User

Register a partner user in the platform.

Endpoint

POST /partner/v1/user/register

Content-Type

application/json

Request Body

{
  "partner_uid": "string",
  "region": "CN"
}
FieldRequiredDescription
partner_uidYesPartner system user ID
regionNoUser region (default: CN)

Response Example

{
  "code": 0,
  "msg": "ok",
  "data": {
    "open_id": "string",
    "access_token": "string",
    "expire_in": 7200
  }
}
FieldDescription
open_idPlatform user identifier
access_tokenAccess token
expire_inToken validity (seconds)

2. Get User Token

Retrieve a new access token using open_id.

Endpoint

GET /partner/v1/user/token

Query Parameters

NameRequiredDescription
open_idYesUser open_id

Response

{
  "code": 0,
  "msg": "ok",
  "data": {
    "open_id": "string",
    "access_token": "string",
    "expire_in": 7200
  }
}

3. Query User Glucose Records

Query glucose records of a user within a time range.
⚠️ Maximum time range: 30 days

Endpoint

GET /partner/v1/user/glucose

Query Parameters

NameRequiredDescription
open_idYesUser open_id
start_timeYesStart timestamp (ms)
end_timeYesEnd timestamp (ms)

Response Data Structure

{
  "open_id": "string",
  "records": [
    {
      "app_id": "string",
      "device_sn": "string",
      "open_id": "string",
      "type": 1,
      "value": 6.3,
      "trend": 1,
      "package_num": 100,
      "measured_at": 1700000000000,
      "app_received_at": 1700000005000
    }
  ]
}

Glucose Trend Values

ValueDescription
1Stable
5Slowly rising
10Slowly falling
15Rapid rise
20Rapid drop

🩺 Device APIs


4. Query Device Information

Retrieve lifecycle and binding information of a device.

Endpoint

GET /partner/v1/device/info

Query Parameters

NameRequiredDescription
device_snYesDevice serial number

Response Data

{
  "device_sn": "string",
  "status": 2,
  "bound_at": 1700000000000,
  "activated_at": 1700001000000,
  "estimated_end_at": 1701200000000,
  "ended_at": 1701300000000,
  "partner_id": "string",
  "app_id": "string",
  "open_id": "string"
}

Device Status

StatusDescription
0Unbound
1Bound
2Activated
3Ended

5. Query Device Glucose Records

Query glucose records by device serial number. If start_time and end_time are not provided, all historical data will be returned.

Endpoint

GET /partner/v1/device/glucose

Query Parameters

NameRequiredDescription
device_snYesDevice SN
start_timeNoStart timestamp (ms)
end_timeNoEnd timestamp (ms)

Response

The response structure is identical to User Glucose Records API.
Register Partner Account

Create Application (app_id / app_secret)

Call Partner APIs