123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta http-equiv="X-UA-Compatible" content="ie=edge" />
- <title>说明文档</title>
- <style>
- html,
- body {
- margin: 0;
- padding: 0;
- }
- .root {
- width: 720px;
- }
- table {
- width: 100%;
- border-collapse: collapse;
- font-size: 14px;
- }
- table td {
- padding: 10px;
- border: 1px solid #eeeeee;
- text-align: left;
- }
- h4 {
- padding-left: 15px;
- }
- </style>
- </head>
- <body>
- <div class="root">
- <div>
- <h2>数据智能平台</h2>
- </div>
- <div>
- <h3>1.接口域名</h3>
- <table>
- <thead>
- <tr>
- <td>环境</td>
- <td>地址</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>线上环境</td>
- <td>
- https://api.sygd.com
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div>
- <h3>2.公共参数</h3>
- <p>文档是所有API使用公共的http头</p>
- <table>
- <thead>
- <tr>
- <td>名称</td>
- <td>类型</td>
- <td>必须</td>
- <td>说明</td>
- <td>示例</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>app_key</td>
- <td>
- String
- </td>
- <td>Y</td>
- <td>用户权限校验key(商务提供)</td>
- <td></td>
- </tr>
- <tr>
- <td>app_key</td>
- <td>
- String
- </td>
- <td>Y</td>
- <td>用户权限校验key(商务提供)</td>
- <td></td>
- </tr>
- <tr>
- <td>app_key</td>
- <td>
- String
- </td>
- <td>Y</td>
- <td>用户权限校验key(商务提供)</td>
- <td></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div>
- <h3>3.参数处理方式</h3>
- <div>
- <h4>1. 请求参数处理方式</h4>
- <pre>
- 根据套餐确定是否需要加密
-
- 如果需要加密,采用aes ecb 加密,对加密后的字节流进行十六进制编码得到十六进制字符串,加密代码见本公司提供的代码示例
-
- 所有参数均使用json结构处理后的json字符串,统一参数名为data
-
- 假设app_secret 为”1234567812345678”
-
- get,delete 方法:
-
- 请求参数放入url
-
- 假设有name参数
-
- 未加密时需对data进行url 编码( 用于传输url中,签名中使用的data值还是原值 )
-
- url 编码前:
-
- http://127.0.0.1/xxx?data={\”name\”:\”张三\”}
-
- url编码后:
-
- http://127.0.0.1/xxx?data=%7B%22name%22%3A%22%E5%BC%A0%E4%B8%89%22%7D
-
- 加密示例:假设对json字符串加密后值为c68d3e8dbc39d1dd9173a5115e9f844a665153ca93234531bfcc468f0dfb8343”,则url为
- http://127.0.0.1/xxx?data=c68d3e8dbc39d1dd9173a5115e9f844a665153ca93234531bfcc468f0dfb8343
- </pre
- >
- </div>
- <div>
- <h4>2. 响应参数处理方式</h4>
- <pre>
- 统一格式为
- {
- "code":int,
- "msg":string,
- "data":string
- }
- 其中code为错误码,msg为错误消息,若加密,则data为对结果的json字符串加密后的字符串,若未加密,则data为结果的json字符串
- </pre>
- </div>
- <div>
- <h3>4. 签名方式</h3>
- <pre>
- text = ts+参数字符串 + app_key + app_secret
- sign = md5(text)
- 若加密则参数字符串使用加密后的
-
- 示例:
- ts = “123”
- app_key = “456”
- app_secret = “789”
- 参数字符串 = “{"name":"张三"}”
- text = “123{"name":"张三"}456789”
- sign = md5(text)= “e10adc3949ba59abbe56e057f20f883e”
- </pre>
- </div>
- </div>
- </div>
- </body>
- </html>
|