### 生成Authorization包头 Source: https://opendoc.yidianting.xin/Api 用于生成包头验证信息,使用Base64编码账号和时间戳。时间戳格式需与签名中的时间戳保持一致。 ```plaintext Base64("abc:20170416142030") = YWJjOjIwMTcwNDE2MTQyMDMw ``` -------------------------------- ### 生成MD5签名 Source: https://opendoc.yidianting.xin/Api 用于生成请求的签名信息,需要包含账号、时间、入参和密钥。加密后的值应转换为32位小写字符串。 ```plaintext MD5("abc:20170416142030:{"parkCode":"123123"}:123456") = f1e1e7f8bc710dd6633bc0d9a9336207 ``` -------------------------------- ### 上报接口成功响应 Source: https://opendoc.yidianting.xin/Api 上报类接口的成功响应格式,status=1表示成功,否则认为推送失败。用于合作方接收智慧停车开放平台推送的数据。 ```json { "data": {}, "message": "ok", "resultCode": 0, "status": 1 } ``` -------------------------------- ### 请求类接口示例 Source: https://opendoc.yidianting.xin/Api 合作方主动调用智慧停车开放平台对外暴露的接口,例如查费、缴费。 ```APIDOC ## POST /openydt/api/v3/{cmd} ### Description This endpoint is used for various requests to the Smart Parking Open Platform, such as fee inquiries and payments. The `{cmd}` parameter specifies the business operation. ### Method POST ### Endpoint `https://openapi-test.yidianting.com.cn/openydt/api/v3/{cmd}?sign=xxx` ### Headers - `Accept`: `application/json;` - `Content-Type`: `application/json;charset=utf-8;` - `Content-Length`: `256;` - `Authorization`: `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` ### Request Body Standard JSON format. ### Parameters #### Common Parameters (included in `key`, `secret`, `parkCode`) - **key** (string) - Required - Your access account provided by the Smart Parking Open Platform. - **secret** (string) - Required - Your access password provided by the Smart Parking Open Platform. - **parkCode** (string) - Required - The unique code for the parking lot. #### Additional Parameters for Discount Interfaces - **traderCode** (string) - Required - Merchant number. #### Signature (`sign`) - The `sign` parameter must be appended to the URL. - **Signature Method**: `MD5(key + ':' + timestamp + ':' + request_parameters + ':' + secret)` - The result should be a 32-character lowercase string. - `timestamp`: Current system time in `yyyyMMddHHmmss` format. - `request_parameters`: The formatted JSON string of the request body (without spaces or newlines). - Example: `MD5("abc:20170416142030:{\"parkCode\":\"123123\"}:123456") = f1e1e7f8bc710dd6633bc0d9a9336207` #### Authorization Header - **Format**: Base64 encoded string of `key + ':' + timestamp`. - Example: `Base64("abc:20170416142030") = YWJjOjIwMTcwNDE2MTQyMDMw` - `timestamp`: Must be the same as the timestamp used in the `sign` parameter. ### Request Example ```json { "parkCode": "123123" } ``` ### Response #### Success Response (status: 1) - **status** (int) - Required - Status code: 1 for business success. - **resultCode** (int) - Required - Business code: 0 for general success, specific codes for errors. - **message** (String) - Required - Description of the result. - **data** (JSONObject) - Required - Returned data object. #### Response Example ```json { "data": {}, "message": "业务成功", "resultCode": 0, "status": 1 } ``` #### Error Codes - **status**: 1 (success), 2 (business failure), 3 (system exception), 4 (signature error), 5 (key error), 6 (unauthorized), 7 (incomplete request parameters). - **resultCode** (when status is 2): 901 (system exception), 902 (remote server no response), 903 (operator not found), 904 (parking lot not found), 905 (vehicle not found), 906 (bill not found), 907 (bill already synchronized), 908 (other error), 909 (invalid request parameters), 910 (no authorized parking lot found), 911 (no permission for this parking lot), 912 (fee inquiry timeout), 1801 (vehicle not found). ### Rate Limiting - Less than 60 authorized parking lots: 300 requests/minute (5 requests/second). - More than 60 authorized parking lots: `number_of_parking_lots * 5` requests/minute. ``` -------------------------------- ### 上报类接口示例 Source: https://opendoc.yidianting.xin/Api 合作方按照智慧停车开放平台的接口规范提供接口给智慧停车主动调用,例如进场上报,离场上报。 ```APIDOC ## POST /openydt/api/v3/{cmd} (for reporting) ### Description This endpoint is used by partners to report data to the Smart Parking Open Platform, such as entry and exit events. The platform will actively call these interfaces provided by the partner. ### Method POST ### Endpoint Similar to request interfaces, the URL structure is `https://openapi-test.yidianting.com.cn/openydt/api/v3/{cmd}`. The `{cmd}` parameter specifies the reporting business. ### Request Body Standard JSON format, consistent with request interfaces. ### Security - **URL, request/response parameters, and encryption methods** are the same as for request interfaces. - **HTTPS is strongly recommended** for receiving data due to security concerns. - **Signature and authorization information** must be verified using the same method as when sending. ### Response #### Success Response (status: 1) - **status** (int) - Required - Status code: 1 indicates successful receipt. - **resultCode** (int) - Required - Business code: 0 for general success. - **message** (String) - Required - Description of the result (e.g., "ok"). - **data** (JSONObject) - Required - Returned data object. #### Response Example ```json { "data": {}, "message": "ok", "resultCode": 0, "status": 1 } ``` ### Retry Mechanism - If the Smart Parking Open Platform receives a response other than success or times out, it will periodically re-push the notification according to a defined strategy to improve delivery success rates. However, final delivery is not guaranteed. ### Throttling Mechanism for Failed Reports - If a specific reporting interface fails consecutively a certain number of times, it will be considered a network/system busy state for the partner. - During this state, the platform will call that interface only once per minute for the partner. - Subsequent reports will be directly stored and trigger a retry attempt. - The interface will return to normal calling frequency once a call is successful; otherwise, the throttled state persists. ### Reporting Failure Limits - If the failure rate for a specific reporting interface reaches 85% within a day, that interface's reporting will be frozen. ``` -------------------------------- ### 标准请求响应格式 Source: https://opendoc.yidianting.xin/Api 展示了智慧停车开放平台请求类接口的标准响应格式,包含业务数据、消息、结果码和状态。 ```json { "data": {}, "message": "业务成功", "resultCode": 0, "status": 1 } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.