Files
iotlcm/apifox-openapi.yaml
T
MiFaZhan 4e2cd43a55 chore: 初始开源发布
iotlcm-onelink-mock:OneLink 挡板服务(本地测试替身)。

- Go module 迁移至 git.5iot.com/iotlcm-public/iotlcm-onelink-mock
- 修复同毫秒内多次生成卡导致 ICCID/IMSI 唯一约束冲突
- 补 Apache-2.0 LICENSE,README 重写并新增 docs/deploy.md
- 移除内部部署资产(CI 触发器 / 镜像推送脚本 / 指定环境部署文档)
- 测试凭据改为 demo_appid / demo_password,真实手机号与内网 IP 脱敏
- 统一 LF 行尾并加 .gitattributes
2026-10-22 15:08:27 +08:00

2252 lines
65 KiB
YAML

openapi: 3.0.3
info:
title: OneLink Mock API
version: 1.0.0
description: |
Import this OpenAPI document into APIFOX to debug the local OneLink mock service.
The documented OneLink business paths use the `/v5/ec/...` prefix. The service
also accepts the compatible `/ec/...` prefix for the same business endpoints.
The `/sim/...` paths expose the unified channel protocol used by
`iotlcm-upstream-chan`.
servers:
- url: http://localhost:8080
description: Local mock service
tags:
- name: Health
description: Service health check.
- name: Admin
description: Local management console APIs.
- name: Card Groups
description: SIM card group management APIs.
- name: Card Export
description: Export SIM cards to Excel for warehouse check-in.
- name: Operation Logs
description: Query and clear operation log records.
- name: Card Generation
description: Batch generate or sync SIM cards.
- name: OneLink Token
description: Token API compatible with OneLink.
- name: OneLink Query
description: Query APIs compatible with OneLink.
- name: OneLink Operate
description: Operation APIs compatible with OneLink.
- name: OneLink Diagnosis
description: Diagnosis and troubleshooting APIs compatible with OneLink.
- name: Chan API
description: Unified SIM channel APIs compatible with iotlcm-upstream-chan.
paths:
/sim/query/sim-basic-info:
post:
tags: [Chan API]
summary: Query SIM channel data
operationId: chanQuerySimBasicInfo
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-session:
post:
tags: [Chan API]
summary: Query SIM session channel data
operationId: chanQuerySimSession
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-status:
post:
tags: [Chan API]
summary: Query SIM status channel data
operationId: chanQuerySimStatus
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-status-batch:
post:
tags: [Chan API]
summary: Query SIM status batch channel data
operationId: chanQuerySimStatusBatch
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-card-bind-status:
post:
tags: [Chan API]
summary: Query SIM card bind status channel data
operationId: chanQuerySimCardBindStatus
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-device-status:
post:
tags: [Chan API]
summary: Query SIM device status channel data
operationId: chanQuerySimDeviceStatus
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-region-limit-status:
post:
tags: [Chan API]
summary: Query SIM region limit status channel data
operationId: chanQuerySimRegionLimitStatus
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-imei:
post:
tags: [Chan API]
summary: Query SIM IMEI channel data
operationId: chanQuerySimImei
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-datausage:
post:
tags: [Chan API]
summary: Query SIM data usage channel data
operationId: chanQuerySimDataUsage
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-datausage-monthly:
post:
tags: [Chan API]
summary: Query SIM monthly data usage channel data
operationId: chanQuerySimDataUsageMonthly
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-datausage-monthly-batch:
post:
tags: [Chan API]
summary: Query SIM monthly data usage batch channel data
operationId: chanQuerySimDataUsageMonthlyBatch
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-datausage-daily:
post:
tags: [Chan API]
summary: Query SIM daily data usage channel data
operationId: chanQuerySimDataUsageDaily
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-datausage-daily-batch:
post:
tags: [Chan API]
summary: Query SIM daily data usage batch channel data
operationId: chanQuerySimDataUsageDailyBatch
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/query/sim-apn-info:
post:
tags: [Chan API]
summary: Query SIM APN info channel data
operationId: chanQuerySimApnInfo
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/change/sim-status:
post:
tags: [Chan API]
summary: Change SIM status via channel
operationId: chanChangeSimStatus
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/sim/change/sim-apn:
post:
tags: [Chan API]
summary: Change SIM APN via channel
operationId: chanChangeSimApn
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ChanRequest" }
responses:
"200":
description: Per-SIM channel responses.
content:
application/json:
schema: { $ref: "#/components/schemas/ChanResponseList" }
/healthz:
get:
tags:
- Health
summary: Health check
operationId: getHealthz
responses:
"200":
description: Service is running.
content:
application/json:
schema:
$ref: "#/components/schemas/HealthResponse"
examples:
ok:
value:
status: ok
/api/state:
get:
tags:
- Admin
summary: Get full mock state
operationId: getAdminState
responses:
"200":
description: Current store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
/api/appids:
post:
tags:
- Admin
summary: Create or update AppID credential
operationId: saveAdminAppId
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Credential"
examples:
default:
value:
appid: "demo_appid"
password: demo_password
name: Default test app
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
"400":
$ref: "#/components/responses/AdminBadRequest"
delete:
tags:
- Admin
summary: Delete AppID credential
operationId: deleteAdminAppId
parameters:
- name: appid
in: query
required: true
schema:
type: string
example: "demo_appid"
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
/api/cards:
get:
tags: [Admin]
summary: Query SIM cards by any exact identifier
operationId: queryAdminCards
description: Supports filtering by keyword (MSISDN/ICCID/IMSI), groupId, and exportStatus.
parameters:
- name: keyword
in: query
required: false
description: Exact MSISDN, ICCID, or IMSI. The service detects the identifier automatically.
schema: { type: string }
example: "1440292201313"
- name: groupId
in: query
required: false
description: Filter cards by group ID. When provided, only cards in that group are returned.
schema: { type: integer }
example: 1
- name: exportStatus
in: query
required: false
description: Filter by export status. Use 'exported' for already exported cards, 'not_exported' for non-exported cards.
schema:
type: string
enum: ["exported", "not_exported"]
example: "not_exported"
- $ref: "#/components/parameters/Page"
- $ref: "#/components/parameters/PageSize"
responses:
"200":
description: Paginated SIM cards.
content:
application/json:
schema: { $ref: "#/components/schemas/CardPage" }
examples:
default:
value:
items:
- msisdn: "1440292201313"
iccid: "898600D6991330004146"
imsi: "460079650004176"
groupId: 1
groupName: "批次一"
cardStatus: "2"
cardBindStatus: "1"
exported: false
total: 1
page: 1
pageSize: 20
post:
tags:
- Admin
summary: Create or update SIM card
operationId: saveAdminCard
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SIMCard"
examples:
default:
value:
msisdn: "1440292201313"
iccid: "898600D6991330004146"
imsi: "460079650004176"
imei: "863725040000001"
remark: Test card A
cardStatus: "2"
onOffStatus: "1"
sessionStatus: "01"
cardBindStatus: "1"
regionLimitStatus: "0"
monthUsageKB: 18432
dailyBaseKB: 614.4
monthlyBaseKB: 18432
growthPerMinuteKB: 1.5
apns:
- name: CMIOT
status: "1"
usageBytes: 13271040
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
"400":
$ref: "#/components/responses/AdminBadRequest"
delete:
tags:
- Admin
summary: Delete SIM card by MSISDN
operationId: deleteAdminCard
parameters:
- name: msisdn
in: query
required: true
schema:
type: string
example: "1440292201313"
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
/api/settings:
post:
tags:
- Admin
summary: Update simulation settings
operationId: saveAdminSettings
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SimulationSettings"
examples:
default:
value:
autoGrowthEnabled: true
defaultGrowthKB: 1.5
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
"400":
$ref: "#/components/responses/AdminBadRequest"
/api/card-groups:
get:
tags: [Card Groups]
summary: List all card groups with card counts
operationId: listCardGroups
responses:
"200":
description: Array of card groups with current card counts.
content:
application/json:
schema:
type: array
items: { $ref: "#/components/schemas/CardGroup" }
examples:
default:
value:
- id: 1
name: "批次一"
createdAt: "2026-08-24 10:00:00"
updatedAt: "2026-08-24 10:00:00"
cardCount: 50
- id: 2
name: "批次二"
createdAt: "2026-08-24 11:00:00"
updatedAt: "2026-08-24 11:00:00"
cardCount: 30
post:
tags: [Card Groups]
summary: Create a new card group
operationId: createCardGroup
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string }
examples:
default:
value:
name: "新批次"
responses:
"200":
description: Created card group.
content:
application/json:
schema: { $ref: "#/components/schemas/CardGroup" }
examples:
default:
value:
id: 3
name: "新批次"
createdAt: "2026-08-24 12:00:00"
updatedAt: "2026-08-24 12:00:00"
cardCount: 0
"400":
$ref: "#/components/responses/AdminBadRequest"
delete:
tags: [Card Groups]
summary: Delete a card group (cards in the group become ungrouped)
operationId: deleteCardGroup
parameters:
- name: id
in: query
required: true
description: Group ID to delete.
schema: { type: integer }
example: 1
responses:
"200":
description: Updated store snapshot after removal.
content:
application/json:
schema: { $ref: "#/components/schemas/Store" }
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
"400":
$ref: "#/components/responses/AdminBadRequest"
/api/cards/export:
get:
tags: [Card Export]
summary: Export SIM cards to Excel (XLSX)
operationId: exportCards
description: Downloads an Excel file containing SIM card information. Selected cards are marked as exported.
parameters:
- name: msisdns
in: query
required: false
description: Comma-separated MSISDNs to export. If omitted, all cards are exported.
schema: { type: string }
example: "1440292201313,138****8000"
responses:
"200":
description: Excel file binary.
headers:
Content-Disposition:
schema:
type: string
example: 'attachment; filename="sim_card_export.xlsx"'
content:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
schema:
type: string
format: binary
/api/operation-logs:
get:
tags: [Operation Logs]
summary: Query operation logs with optional filters
operationId: queryOperationLogs
parameters:
- name: keyword
in: query
required: false
description: Fuzzy match against target, path, or message.
schema: { type: string }
example: "1440292201313"
- name: category
in: query
required: false
description: Filter by operation category.
schema: { type: string }
example: "generate"
- name: result
in: query
required: false
description: Filter by result status.
schema: { type: string }
example: "success"
- $ref: "#/components/parameters/Page"
- $ref: "#/components/parameters/PageSize"
responses:
"200":
description: Paginated operation logs.
content:
application/json:
schema: { $ref: "#/components/schemas/OperationLogPage" }
examples:
default:
value:
items:
- id: 1
createdAt: "2026-08-24 10:00:00"
category: generate
action: 一键生成 SIM 卡
target: "3"
method: POST
path: /api/generate
params: "{\"count\":3}"
result: success
statusCode: 200
durationMs: 150
total: 1
page: 1
pageSize: 20
/api/sync:
post:
tags: [Card Generation]
summary: Generate SIM cards without group assignment
operationId: syncCards
description: Generates new SIM cards without assigning them to a card group.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [count]
properties:
count: { type: integer, minimum: 1 }
examples:
default:
value:
count: 100
responses:
"200":
description: Sync result with scanned and synced counts.
content:
application/json:
schema: { $ref: "#/components/schemas/SyncResult" }
examples:
default:
value:
scanned: 100
synced: 100
"400":
$ref: "#/components/responses/AdminBadRequest"
/api/generate:
post:
tags: [Card Generation]
summary: Generate SIM cards with optional group assignment
operationId: generateCards
description: Batch-generate SIM cards. Specify a groupId to assign cards to a group, or omit for ungrouped cards.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [count]
properties:
count: { type: integer, minimum: 1 }
groupId: { type: integer, nullable: true }
examples:
withGroup:
value:
count: 50
groupId: 1
withoutGroup:
value:
count: 200
responses:
"200":
description: Generation result with generated count and total cards.
content:
application/json:
schema: { $ref: "#/components/schemas/GenerateResult" }
examples:
default:
value:
generated: 50
total: 51
"400":
$ref: "#/components/responses/AdminBadRequest"
/api/orders:
get:
tags: [Admin]
summary: List persisted operation orders
operationId: listAdminOrders
parameters:
- $ref: "#/components/parameters/Page"
- $ref: "#/components/parameters/PageSize"
responses:
"200":
description: Paginated orders, newest first.
content:
application/json:
schema: { $ref: "#/components/schemas/OrderPage" }
delete:
tags:
- Admin
summary: Clear operation orders
operationId: clearAdminOrders
responses:
"200":
description: Updated store snapshot.
content:
application/json:
schema:
$ref: "#/components/schemas/Store"
examples:
default:
$ref: "#/components/examples/StoreSnapshot"
/v5/ec/get/token:
get:
tags:
- OneLink Token
summary: Get token
description: Returns a token with a 3600 second TTL. Set `refresh=0` to reuse an unexpired token when available.
operationId: getOneLinkToken
parameters:
- $ref: "#/components/parameters/AppID"
- $ref: "#/components/parameters/Password"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Refresh"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- token: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
ttl: "3600"
invalidCredential:
value:
status: "12021"
message: Invalid authentication
result: []
/v5/ec/query/sim-basic-info:
get:
tags:
- OneLink Query
summary: Query SIM basic info
operationId: querySimBasicInfo
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
$ref: "#/components/responses/OneLinkBasicInfo"
/v5/ec/query/sim-session:
get:
tags:
- OneLink Query
summary: Query SIM session
operationId: querySimSession
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- simSessionList:
- apnId: CMIOT
status: "01"
ip: 192.0.2.42
ipv6Prefix: ""
ipv6: ""
createDate: "2026-06-06 14:00:00"
rat: "6"
/v5/ec/query/sim-status:
get:
tags:
- OneLink Query
summary: Query SIM status
operationId: querySimStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- cardStatus: "2"
lastChangeDate: "2026-06-06 14:00:00"
/v5/ec/query/sim-imei:
get:
tags:
- OneLink Query
summary: Query SIM IMEI
operationId: querySimImei
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- imei: "863725040000001"
/v5/ec/query/sim-stop-reason:
get:
tags: [OneLink Diagnosis]
summary: Query SIM stop reason
operationId: querySimStopReason
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-frozen-state-info:
get:
tags: [OneLink Diagnosis]
summary: Query SIM frozen state
operationId: querySimFrozenState
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-apn-session-info:
get:
tags: [OneLink Diagnosis]
summary: Query SIM APN sessions
operationId: querySimApnSessions
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-activated-features-info:
get:
tags: [OneLink Diagnosis]
summary: Query activated communication features
operationId: querySimActivatedFeatures
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-operating-status:
get:
tags: [OneLink Diagnosis]
summary: Query terminal operating status
operationId: querySimOperatingStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-data-diagnosis:
get:
tags: [OneLink Diagnosis]
summary: Query SIM APN and PCC data diagnosis
operationId: querySimDataDiagnosis
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200": { $ref: "#/components/responses/OneLinkBasicInfo" }
/v5/ec/query/sim-data-usage-inpool:
get:
tags:
- OneLink Query
summary: Query SIM data usage in pool
operationId: querySimDataUsageInPool
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- apnList:
- apnName: CMIOT
apnUseAmount: "13271040"
- apnName: CMMTM
apnUseAmount: "5687562.24"
/v5/ec/query/sim-data-usage:
get:
tags:
- OneLink Query
summary: Query SIM data usage
operationId: querySimDataUsage
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- dataAmount: "18432.00"
apnUseAmountList:
- apnName: CMIOT
apnUseAmount: "12902.40"
pccCodeUseAmountList:
- pccCode: default
pccCodeUseAmount: "12902.40"
/v5/ec/query/sim-data-usage-monthly/batch:
get:
tags:
- OneLink Query
summary: Batch query monthly data usage
operationId: queryMonthlyDataUsageBatch
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdns"
- $ref: "#/components/parameters/Iccids"
- $ref: "#/components/parameters/Imsis"
- $ref: "#/components/parameters/MonthlyQueryDate"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- deadLine: "20260705"
dataAmountList:
- msisdn: "1440292201313"
dataAmount: "18432"
apnDataAmountList:
- apnName: CMIOT
apnDataAmount: "12902.40"
- apnName: CMMTM
apnDataAmount: "5529.60"
/v5/ec/query/sim-data-usage-daily/batch:
get:
tags:
- OneLink Query
summary: Batch query daily data usage
operationId: queryDailyDataUsageBatch
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdns"
- $ref: "#/components/parameters/Iccids"
- $ref: "#/components/parameters/Imsis"
- $ref: "#/components/parameters/DailyQueryDate"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- dataAmountList:
- msisdn: "1440292201313"
dataAmount: "614.40"
apnDataAmountList:
- apnName: CMIOT
apnDataAmount: "430.08"
- apnName: CMMTM
apnDataAmount: "184.32"
/v5/ec/query/apn-info:
get:
tags:
- OneLink Query
summary: Query APN info
operationId: queryApnInfo
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- apnList:
- apnName: CMIOT
status: "1"
- apnName: CMMTM
status: "1"
/v5/ec/query/card-bind-status:
get:
tags:
- OneLink Query
summary: Query card bind status
operationId: queryCardBindStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
- name: testType
in: query
required: false
description: Accepted for client compatibility; the mock service does not validate it.
schema:
type: string
example: "0"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- result: "1"
/v5/ec/query/on-off-status:
get:
tags:
- OneLink Query
summary: Query on/off status
operationId: queryOnOffStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- status: "1"
/v5/ec/query/region-limit-status:
get:
tags:
- OneLink Query
summary: Query region limit status
operationId: queryRegionLimitStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- regionLimitStatus: "0"
/v5/ec/change/sim-status:
get:
tags:
- OneLink Operate
summary: Change SIM status
operationId: changeSimStatus
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
- name: operType
in: query
required: true
description: Operation type. Known mappings in this mock are 0->status 4, 1/2/5/6->status 2, 3/8->status 7, 4/9->status 1.
schema:
type: string
enum:
- "0"
- "1"
- "2"
- "3"
- "4"
- "5"
- "6"
- "8"
- "9"
example: "0"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- msisdn: "1440292201313"
orderNum: ORD2026070614000000a1b2c3
/v5/ec/operate/sim-apn-function:
get:
tags:
- OneLink Operate
summary: Enable or disable SIM APN function
operationId: operateSimApnFunction
parameters:
- $ref: "#/components/parameters/Token"
- $ref: "#/components/parameters/TransID"
- $ref: "#/components/parameters/Msisdn"
- $ref: "#/components/parameters/Iccid"
- $ref: "#/components/parameters/Imsi"
- name: apnName
in: query
required: true
schema:
type: string
example: CMIOT
- name: operType
in: query
required: true
description: "0 disables APN, 1 enables APN."
schema:
type: string
enum:
- "0"
- "1"
example: "1"
responses:
"200":
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- msisdn: "1440292201313"
orderNum: APN2026070614000000a1b2c3
components:
parameters:
Page:
name: page
in: query
required: false
schema: { type: integer, minimum: 1, default: 1 }
PageSize:
name: pageSize
in: query
required: false
schema: { type: integer, minimum: 1, maximum: 100, default: 20 }
AppID:
name: appid
in: query
required: true
schema:
type: string
example: "demo_appid"
Password:
name: password
in: query
required: true
schema:
type: string
example: demo_password
Refresh:
name: refresh
in: query
required: false
description: Use 0 to reuse an unexpired token; use 1 or omit to issue a new token.
schema:
type: string
enum:
- "0"
- "1"
example: "1"
Token:
name: token
in: query
required: true
schema:
type: string
example: "<token>"
TransID:
name: transid
in: query
required: false
description: Client transaction id. The mock currently accepts it without validation.
schema:
type: string
example: "demo_appid2026070209300000000001"
Msisdn:
name: msisdn
in: query
required: false
description: SIM identifier. For single-card endpoints, provide exactly one of msisdn, iccid, or imsi.
schema:
type: string
example: "1440292201313"
Iccid:
name: iccid
in: query
required: false
description: SIM identifier. For single-card endpoints, provide exactly one of msisdn, iccid, or imsi.
schema:
type: string
example: "898600D6991330004146"
Imsi:
name: imsi
in: query
required: false
description: SIM identifier. For single-card endpoints, provide exactly one of msisdn, iccid, or imsi.
schema:
type: string
example: "460079650004176"
Msisdns:
name: msisdns
in: query
required: false
description: Underscore-separated SIM identifiers. For batch endpoints, provide exactly one of msisdns, iccids, or imsis.
schema:
type: string
example: "1440292201313_138****8000"
Iccids:
name: iccids
in: query
required: false
description: Underscore-separated SIM identifiers. For batch endpoints, provide exactly one of msisdns, iccids, or imsis.
schema:
type: string
example: "898600D6991330004146_898602B2221430000005"
Imsis:
name: imsis
in: query
required: false
description: Underscore-separated SIM identifiers. For batch endpoints, provide exactly one of msisdns, iccids, or imsis.
schema:
type: string
example: "460079650004176_460079650004177"
MonthlyQueryDate:
name: queryDate
in: query
required: false
description: Month to query, formatted as yyyyMM.
schema:
type: string
pattern: "^[0-9]{6}$"
example: "202607"
DailyQueryDate:
name: queryDate
in: query
required: false
description: Date to query, formatted as yyyyMMdd.
schema:
type: string
pattern: "^[0-9]{8}$"
example: "20260705"
responses:
AdminBadRequest:
description: Invalid request body.
content:
application/json:
schema:
$ref: "#/components/schemas/AdminError"
examples:
badRequest:
value:
error: invalid character
OneLinkBasicInfo:
description: OneLink response.
content:
application/json:
schema:
$ref: "#/components/schemas/OneLinkResponse"
examples:
success:
value:
status: "0"
message: OK
result:
- msisdn: "1440292201313"
imsi: "460079650004176"
iccid: "898600D6991330004146"
activeDate: "2025-07-09 14:00:00"
openDate: "2025-07-06 14:00:00"
remark: Test card A
missing:
value:
status: "14008"
message: Not found
result: []
schemas:
ChanRequest:
type: object
required: [simKeys]
properties:
simKeys:
type: array
items:
$ref: "#/components/schemas/ChanSimKey"
reqData:
type: object
additionalProperties: true
example:
simKeys:
- chanKey: channel_yd_mock
iccid: "8986040000000000001"
imsi: "460040000000000001"
msisdn: "138****8000"
reqData: {}
ChanSimKey:
type: object
properties:
chanKey: { type: string, example: channel_yd_mock }
iccid: { type: string, example: "8986040000000000001" }
imsi: { type: string, example: "460040000000000001" }
msisdn: { type: string, example: "138****8000" }
ChanResponseList:
type: array
items:
type: object
properties:
code: { type: integer, example: 0 }
message: { type: string, example: success }
simKey: { $ref: "#/components/schemas/ChanSimKey" }
resData:
type: object
additionalProperties: true
CardPage:
type: object
required: [items, total, page, pageSize]
properties:
items: { type: array, items: { $ref: "#/components/schemas/SIMCard" } }
total: { type: integer }
page: { type: integer }
pageSize: { type: integer }
OrderPage:
type: object
required: [items, total, page, pageSize]
properties:
items: { type: array, items: { $ref: "#/components/schemas/Order" } }
total: { type: integer }
page: { type: integer }
pageSize: { type: integer }
HealthResponse:
type: object
properties:
status:
type: string
example: ok
AdminError:
type: object
properties:
error:
type: string
example: appid and password are required
OneLinkResponse:
type: object
required:
- status
- message
- result
properties:
status:
type: string
description: OneLink status code. "0" means success.
example: "0"
message:
type: string
example: OK
result:
type: array
items:
type: object
additionalProperties: true
TokenResult:
type: object
properties:
token:
type: string
example: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
ttl:
type: string
example: "3600"
BasicInfoResult:
type: object
properties:
msisdn:
type: string
example: "1440292201313"
imsi:
type: string
example: "460079650004176"
iccid:
type: string
example: "898600D6991330004146"
activeDate:
type: string
example: "2025-07-09 14:00:00"
openDate:
type: string
example: "2025-07-06 14:00:00"
remark:
type: string
example: Test card A
SessionResult:
type: object
properties:
simSessionList:
type: array
items:
$ref: "#/components/schemas/SessionItem"
SessionItem:
type: object
properties:
apnId:
type: string
example: CMIOT
status:
type: string
example: "01"
ip:
type: string
example: 192.0.2.42
ipv6Prefix:
type: string
example: ""
ipv6:
type: string
example: ""
createDate:
type: string
example: "2026-06-06 14:00:00"
rat:
type: string
example: "6"
StatusResult:
type: object
properties:
cardStatus:
type: string
example: "2"
lastChangeDate:
type: string
example: "2026-06-06 14:00:00"
ImeiResult:
type: object
properties:
imei:
type: string
example: "863725040000001"
ApnUsageInPoolResult:
type: object
properties:
apnList:
type: array
items:
$ref: "#/components/schemas/ApnUsageInPoolItem"
ApnUsageInPoolItem:
type: object
properties:
apnName:
type: string
example: CMIOT
apnUseAmount:
type: string
example: "13271040"
DataUsageResult:
type: object
properties:
dataAmount:
type: string
example: "18432.00"
apnUseAmountList:
type: array
items:
$ref: "#/components/schemas/ApnUseAmountItem"
ApnUseAmountItem:
type: object
properties:
apnName:
type: string
example: CMIOT
apnUseAmount:
type: string
example: "12902.40"
pccCodeUseAmountList:
type: array
items:
$ref: "#/components/schemas/PccCodeUseAmountItem"
PccCodeUseAmountItem:
type: object
properties:
pccCode:
type: string
example: default
pccCodeUseAmount:
type: string
example: "12902.40"
BatchUsageResult:
type: object
properties:
deadLine:
type: string
example: "20260705"
dataAmountList:
type: array
items:
$ref: "#/components/schemas/BatchUsageItem"
BatchUsageItem:
type: object
properties:
msisdn:
type: string
example: "1440292201313"
iccid:
type: string
example: "898600D6991330004146"
imsi:
type: string
example: "460079650004176"
dataAmount:
type: string
example: "18432"
apnDataAmountList:
type: array
items:
$ref: "#/components/schemas/ApnDataAmountItem"
ApnDataAmountItem:
type: object
properties:
apnName:
type: string
example: CMIOT
apnDataAmount:
type: string
example: "12902.40"
ApnInfoResult:
type: object
properties:
apnList:
type: array
items:
$ref: "#/components/schemas/ApnInfoItem"
ApnInfoItem:
type: object
properties:
apnName:
type: string
example: CMIOT
status:
type: string
example: "1"
CardBindStatusResult:
type: object
properties:
result:
type: string
example: "1"
OnOffStatusResult:
type: object
properties:
status:
type: string
example: "1"
RegionLimitStatusResult:
type: object
properties:
regionLimitStatus:
type: string
example: "0"
OperationResult:
type: object
properties:
msisdn:
type: string
example: "1440292201313"
iccid:
type: string
example: "898600D6991330004146"
imsi:
type: string
example: "460079650004176"
orderNum:
type: string
example: ORD2026070614000000a1b2c3
Store:
type: object
properties:
appids:
type: array
items:
$ref: "#/components/schemas/Credential"
groups:
type: array
items:
$ref: "#/components/schemas/CardGroup"
cards:
type: array
items:
$ref: "#/components/schemas/SIMCard"
tokens:
type: object
additionalProperties:
$ref: "#/components/schemas/Token"
orders:
type: array
items:
$ref: "#/components/schemas/Order"
settings:
$ref: "#/components/schemas/SimulationSettings"
CardGroup:
type: object
required: [id, name, createdAt, updatedAt]
properties:
id:
type: integer
example: 1
name:
type: string
example: "批次一"
createdAt:
type: string
example: "2026-08-24 10:00:00"
updatedAt:
type: string
example: "2026-08-24 10:00:00"
cardCount:
type: integer
example: 50
Credential:
type: object
required:
- appid
- password
properties:
appid:
type: string
example: "demo_appid"
password:
type: string
example: demo_password
name:
type: string
example: Default test app
enabled:
type: boolean
example: true
createdAt:
type: string
example: "2026-07-06 14:00:00"
lastToken:
type: string
example: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
tokenExpires:
type: string
example: "2026-07-06 15:00:00"
Token:
type: object
properties:
appid:
type: string
example: "demo_appid"
value:
type: string
example: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
expiresAt:
type: string
format: date-time
example: "2026-07-06T15:00:00+08:00"
APN:
type: object
properties:
name:
type: string
example: CMIOT
status:
type: string
description: "APN enable status. 0=disabled, 1=enabled."
example: "1"
diagnosisStatus:
type: string
example: "2"
usageBytes:
type: number
format: double
example: 13271040
modifyTime:
type: string
example: "20260606140000"
serviceUsageState:
type: string
example: "1"
overUseDetails:
type: string
example: ""
pccs:
type: array
items:
$ref: "#/components/schemas/PCC"
PCC:
type: object
properties:
serviceCode:
type: string
example: default
name:
type: string
example: "APN 缺省流量"
policyStatus:
type: string
example: "2"
serviceUsageState:
type: string
example: "1"
modifyTime:
type: string
example: "20260606140000"
SIMCard:
type: object
required:
- msisdn
properties:
groupId:
type: integer
description: Group ID the card belongs to. 0 or omitted means ungrouped.
example: 1
groupName:
type: string
example: "批次一"
msisdn:
type: string
example: "1440292201313"
iccid:
type: string
example: "898600D6991330004146"
imsi:
type: string
example: "460079650004176"
imei:
type: string
example: "863725040000001"
remark:
type: string
example: Test card A
cardStatus:
type: string
description: "SIM card status. 1=disabled, 2=active, 4=stopped, 7=in transit."
example: "2"
lastChangeDate:
type: string
example: "2026-06-06 14:00:00"
stopReason:
type: string
example: "000000000000"
frozenStatus:
type: string
example: "0"
frozenReason:
type: string
example: ""
frozenOperTime:
type: string
example: "20260606140000"
openDate:
type: string
example: "2025-07-06 14:00:00"
activeDate:
type: string
example: "2025-07-09 14:00:00"
onOffStatus:
type: string
description: "Power status. 0=off, 1=on."
example: "1"
sessionStatus:
type: string
description: "Session status. 00=disconnected, 01=connected."
example: "01"
sessionCreateDate:
type: string
example: "2026-06-06 14:00:00"
ip:
type: string
example: 192.0.2.42
ipv6Prefix:
type: string
example: ""
ipv6:
type: string
example: ""
rat:
type: string
example: "6"
cardBindStatus:
type: string
description: "Card bind status. 1=bound (not separated), 0=unbound (separated)."
example: "1"
regionLimitStatus:
type: string
example: "0"
areaRestrictType:
type: string
example: "1"
restrictedArea:
type: string
example: "200"
monthUsageKB:
type: number
format: double
example: 18432
poolUsageBytes:
type: number
format: double
example: 18874368
dailyBaseKB:
type: number
format: double
example: 614.4
monthlyBaseKB:
type: number
format: double
example: 18432
growthPerMinuteKB:
type: number
format: double
example: 1.5
apns:
type: array
items:
$ref: "#/components/schemas/APN"
lastUsageUpdateTime:
type: string
format: date-time
example: "2026-07-06T14:00:00+08:00"
exported:
type: boolean
description: Whether this card has been exported.
example: false
exportCheckedAt:
type: string
description: Timestamp when the card was last exported.
example: "2026-08-24 10:00:00"
Order:
type: object
properties:
orderNum:
type: string
example: ORD2026070614000000a1b2c3
msisdn:
type: string
example: "1440292201313"
iccid:
type: string
example: "898600D6991330004146"
imsi:
type: string
example: "460079650004176"
type:
type: string
example: sim-status
operType:
type: string
example: "0"
apnName:
type: string
example: CMIOT
status:
type: string
example: completed
createdAt:
type: string
example: "2026-07-06 14:00:00"
OperationLog:
type: object
required: [id, createdAt, category, action, method, path, result, statusCode, durationMs]
properties:
id:
type: integer
example: 1
createdAt:
type: string
example: "2026-08-24 10:00:00"
category:
type: string
description: Operation category, e.g. generate, sync, export.
example: generate
action:
type: string
example: "一键生成 SIM 卡"
target:
type: string
example: "3"
method:
type: string
example: POST
path:
type: string
example: /api/generate
params:
type: string
example: "{\"count\":3}"
result:
type: string
example: success
statusCode:
type: integer
example: 200
message:
type: string
example: ""
durationMs:
type: integer
example: 150
clientIp:
type: string
example: "127.0.0.1"
OperationLogPage:
type: object
required: [items, total, page, pageSize]
properties:
items:
type: array
items: { $ref: "#/components/schemas/OperationLog" }
total:
type: integer
example: 42
page:
type: integer
example: 1
pageSize:
type: integer
example: 20
GenerateResult:
type: object
required: [generated, total]
properties:
generated:
type: integer
example: 50
total:
type: integer
example: 51
SyncResult:
type: object
required: [scanned, synced]
properties:
scanned:
type: integer
example: 100
synced:
type: integer
example: 100
SimulationSettings:
type: object
properties:
autoGrowthEnabled:
type: boolean
example: true
defaultGrowthKB:
type: number
format: double
example: 1.5
examples:
StoreSnapshot:
value:
appids:
- appid: "demo_appid"
password: demo_password
name: Default test app
enabled: true
createdAt: "2026-07-06 14:00:00"
groups:
- id: 1
name: "批次一"
createdAt: "2026-08-24 10:00:00"
updatedAt: "2026-08-24 10:00:00"
cardCount: 1
cards:
- groupId: 1
groupName: "批次一"
msisdn: "1440292201313"
iccid: "898600D6991330004146"
imsi: "460079650004176"
imei: "863725040000001"
remark: Test card A
cardStatus: "2"
lastChangeDate: "2026-06-06 14:00:00"
stopReason: "000000000000"
frozenStatus: "0"
openDate: "2025-07-06 14:00:00"
activeDate: "2025-07-09 14:00:00"
onOffStatus: "1"
sessionStatus: "01"
sessionCreateDate: "2026-06-06 14:00:00"
ip: 192.0.2.42
ipv6Prefix: ""
ipv6: ""
rat: "6"
cardBindStatus: "1"
regionLimitStatus: "0"
areaRestrictType: "1"
restrictedArea: "200"
monthUsageKB: 18432
poolUsageBytes: 18874368
dailyBaseKB: 614.4
monthlyBaseKB: 18432
growthPerMinuteKB: 1.5
exported: false
apns:
- name: CMIOT
status: "1"
diagnosisStatus: "2"
usageBytes: 13271040
modifyTime: "20260606140000"
serviceUsageState: "1"
pccs:
- serviceCode: default
name: "APN 缺省流量"
policyStatus: "2"
serviceUsageState: "1"
modifyTime: "20260606140000"
- name: CMMTM
status: "1"
usageBytes: 5687562.24
lastUsageUpdateTime: "2026-07-06T14:00:00+08:00"
tokens: {}
orders: []
settings:
autoGrowthEnabled: true
defaultGrowthKB: 1.5