NBSIM Open API Docs
  1. Interface Description
NBSIM Open API Docs
  • User Guide
  • Interface Description
    • API Integration Support
  • Integrated Card Interfaces
    • Mapping of Integrated Card IDs
      POST
    • Retrieval of Cumulative Usage for Integrated Cards
      POST
  1. Interface Description

API Integration Support

I. Communication Method#

Communication Protocol All API requests are transmitted via the HTTP protocol, supporting both GET and POST methods. Due to data length restrictions for GET requests, the POST method must be used for large data payloads.
Security & Authentication To ensure request authenticity and prevent data tampering, all parameters must be Base64-encoded and secured with a SHA256 signature. All response messages are returned in JSON format.

II. Communication Protocol#

2.1 Request Message Structure#

Both GET and POST requests must include the following three public parameters:
Field NameChinese NameMandatoryDescription
param业务参数YesBusiness request parameters encoded in BASE64
sign签名数据YesThe value obtained by SHA256 signing param + saltKey (secret key)
sType签名类型YesSignature type, fixed as s256 (indicating SHA256)

2.2 Param Business Parameter Structure#

Field NameChinese NameDescription
appId应用IDThe application ID initiating the business request
_flowNo业务流水号Unique business request serial number (random string)
_bizTime业务发生时间Time of business invocation (millisecond timestamp,timestamp needs to be within 10 minutes from time of request)

Example Business Parameters:#

{
  "_flowNo": "b95a5b5d5b5c5e5f5a5b5c5d5e5f5a5b",
  "_bizTime": 1672531200000,
  "appId": "your_app_id",
  "key1": "value1",
  "key2": "value2"
}

2.3 Signature Generation Process#

(1)Convert business parameters into a JSON string
(2)Encode the string in Base64 to get param
(3)Concatenate param + saltKey (secret key)
(4)Encrypt the concatenated result with SHA256 to get the signature value (sign)

Java Code Example#

// Business parameters
TreeMap treeMap = new TreeMap();
treeMap.put("simNoList","123,456");
treeMap.put("_flowNo", UUID.randomUUID().toString().replace("-",""));
treeMap.put("_bizTime",System.currentTimeMillis());
treeMap.put("appId",appId);
String paramStr = JSON.toJSONString(treeMap);
String param = Base64.getEncoder().encodeToString(paramStr.getBytes());
String sign = JsMessageDigestUtil.SHA256(param + saltKey);

2.4 Request Examples#

✅ POST Request
Content-Type: application/json
Body:
{
  "param": "eyJfZmxvd05vIjoi...",
  "sign": "a1b2c3d4e5...",
  "sType": "s256"
}
✅ GET Request
URL Format:
https://api.nbsim.com/path?param=xxx&sign=xxx&sType=s256

III. Response Message Structure#

All responses follow the JSON format below

3.1 Successful Response#

{
  "code": 0,
  "msg": "Success",
  "data": { ... }
}

3.2 Failed Response#

{
  "code": 7400,
  "msg": "appId does not exist",
   data: null
}

3.3 Response Field Description#

Field NameChinese NameDescription
code响应码0 = Success; Other values = Failure
msg提示信息
data业务数据Specific data refers to the interface description

IV. Unified Error Codes#

Standard system error codes are defined as follows:
codemessage
7400appId does not exist
7401Signature verification failed
othersHTTP status code or custom error code

V. Security Specifications#

5.1 Communication Security#

All requests must carry a signature, which will be verified by the server

5.2 Data Security#

(1)Business parameters must be transmitted after Base64 encoding
(2)Use SHA256 signature to ensure request integrity (prevent tampering)
(3)saltKey is confidential information and must not be disclosed

VI. Download Java Test Cases#

https://github.com/nishuibaichuan/NBSIM-Java-Signature

Ⅶ. Postman Example#

https://github.com/nishuibaichuan/NBSIM-Open-API.postman_collection
Modified at 2026-01-09 02:42:30
Previous
User Guide
Next
Mapping of Integrated Card IDs
Built with