📘 Integration Guide
1. Overview
This API is designed for Partner developers to integrate with the glucose device platform. Main capabilities include:- User registration & token management
- Device information query
- User glucose data query
- Device glucose data query
2. API Endpoint
🔐 Authentication & Signature Mechanism
To ensure platform security, all Partner APIs use an AppId + AppSecret request signature mechanism. Before calling APIs, partners must:- Register on the Partner Platform
- Create an Application
- Obtain
app_idandapp_secret - Sign every API request
Terminology
| Term | Description |
|---|---|
| app_id | Application identifier (public) |
| app_secret | Application secret key (private) |
| signature | Request signature |
Required HTTP Headers
Each API request must include the following headers:| Header | Required | Description |
|---|---|---|
| X-App-Id | ✅ | Application ID |
| X-Timestamp | ✅ | Current timestamp (milliseconds) |
| X-Nonce | ✅ | Random string (anti-replay) |
| X-Signature | ✅ | Request signature |
Signature Data Scope
The signature is generated from the following components:- HTTP Method
- URL Path (without domain)
- Query parameters
- Public header parameters
- Request body (POST / PUT only)
Signature Generation Process
Step 1 — Collect Parameters
Include:- Header parameters:
- X-App-Id
- X-Timestamp
- X-Nonce
- Query parameters, for example:
⚠️ X-Signature itself must NOT participate in signing.
Step 2 — Sort Parameters
Sort all parameter names in ASCII ascending order. Example:Step 3 — Build Signature String
Concatenation rule:- HTTP method must be uppercase
- Path excludes protocol and domain
- No separators between keys and values
- Body must be the raw JSON string
Step 4 — HMAC-SHA256
Go Signature Example
Example Request
Security Recommendations
- ❗ Never expose
app_secretin frontend code - ❗ Do not store secrets in plaintext
- ✅ Use server-side signing only
- ✅ Rotate secrets periodically
- ✅ Requests older than 5 minutes will be rejected
Common Response Format
| Field | Description |
|---|---|
| code | 0 means success |
| msg | Business message |
| data | Response payload |
Common Error Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1001 | Unauthorized / token invalid |
| 1002 | Permission denied |
Time Format
All timestamps are:Recommended Integration Flow
✅ Document generated on: 2026-01-30
