├── LICENSE ├── README.md ├── authentication.md ├── avatar.md ├── error_code.md ├── home.md ├── login.md ├── new.md ├── notifications.md ├── register.md ├── reply.md ├── seccode.md └── topic.md /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015 Canbin Lin (lincanbin@hotmail.com) 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Carbon Forum HTTP API Documentation 2 | Carbon Forum HTTP API Documentation. 3 | 4 | When you are use API, you need to setting api path first.Set up a new website site like `https://api.example.com`, and fill in the path on the page `htttps://your.websit.com/dashboard#dashboard3`. Fill in the path to this line `客户端API域名` 5 | 6 | ### Guide 7 | * [API Authentication description](authentication.md) 8 | * [User Authentication description](login.md) 9 | * [Public error code](error_code.md) 10 | 11 | ### API List 12 | Name|Description 13 | ---|--- 14 | [/page/{{page}}](home.md)|Get topic list 15 | [/login](login.md)|Login (User Authentication description) 16 | [/seccode](seccode.md)|Seccode 17 | [/new](new.md)|Create new topic 18 | [/notifications](notifications.md)|Get notifications list 19 | [/register](register.md)|Register 20 | [/reply](reply.md)|Reply to a topic 21 | [/t/{{topic_id}}-{{page}}](topic.md)|Get the topic information and replies 22 | [/avatar](avatar.md)|Avatar 23 | -------------------------------------------------------------------------------- /authentication.md: -------------------------------------------------------------------------------- 1 | # API Authentication Parameters 2 | 3 | ### Preparation 4 | You need to set up a pair of corresponding Key and Secret in ```config.php``` like this: 5 | ```php 6 | > 16 | // Free to modify 17 | $APISignature = array(); 18 | $APISignature[12450] = 'b40484df0ad979d8ba7708d24c301c38';//For Android 19 | ``` 20 | 21 | ### Parameters 22 | Key|Value Type|Description|Obligatory|Example 23 | ---|---|---|---|--- 24 | SKey|Integer|SKey=APIKey, you can find APIKey and APISecret in ```config.php```|√|12450 25 | STime|Integer(10)|Unix Timestamp|√|1447253145 26 | SValue|String(32)|md5(SKey:APISecret:STime)|√|89809a5201b04c608ffa50d63892a2ca 27 | ```java 28 | // Example 29 | String SValue = md5("12450" + "b40484df0ad979d8ba7708d24c301c38" + "1447253145"); 30 | //SValue = "89809a5201b04c608ffa50d63892a2ca"; 31 | ``` 32 | -------------------------------------------------------------------------------- /avatar.md: -------------------------------------------------------------------------------- 1 | # Get the User Avatar 2 | 3 | ### HTTP request address 4 | `http://api.example.com/upload/avatar/{{size}}/{{userID}}.png` 5 | 6 | ### Menthod 7 | GET 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | size | string| `large` or `middle` | √ | 13 | userID | string | user id | √ 14 | 15 | 16 | ### HTTP Response 17 | Success: 18 | ``` 19 | User avatar response image data. Middle Image size is 48*48. 20 | Large Image size is 256*256. 21 | ``` 22 | 23 | Fail: 24 | * This API does not throw an error now. 25 | -------------------------------------------------------------------------------- /error_code.md: -------------------------------------------------------------------------------- 1 | # Public Error Code 2 | The HTTP response message is accompanied by the same Status Code in HTTP Header when these errors occur. 3 | 4 | ### HTTP Response Header 5 | ``` 6 | HTTP/1.1 403 Forbidden 7 | Status: 403 Forbidden 8 | ``` 9 | ### HTTP Response Body 10 | ```json 11 | { 12 | "Status": 0, 13 | "ErrorCode": 403, 14 | "ErrorMessage": "403 Forbidden" 15 | } 16 | ``` 17 | 18 | ### Error Code 19 | Error Code|Error Message 20 | ---|--- 21 | 400|Bad Request. Check that your request parameters is consistent with the API documentation. 22 | 401|Unauthorized. This API requires [user authentication parameters](login.md#user-authentication-parameters). Parameters error or no given. 23 | 403|Forbidden. [API Authentication parameter](authentication.md#parameters) error or no given. 24 | 404|The requested resource does not exist. 25 | 500|Internal Server Error 26 | 503|Service Unavailable 27 | -------------------------------------------------------------------------------- /home.md: -------------------------------------------------------------------------------- 1 | # Get Topic List 2 | 3 | ### HTTP request address 4 | `http://api.example.com/page/{{page}}` 5 | 6 | ### Menthod 7 | GET 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | [API Authentication parameter](authentication.md#parameters)|||√| 13 | {{page}}|int|Page number of the topic list. This parameter should be constructed in the requests address. |√| 14 | 15 | 16 | ### HTTP Response 17 | Success: 18 | ```json 19 | { 20 | "Status": 1, 21 | "PageTitle": "Carbon Forum", 22 | "Page": 1, 23 | "TotalPage": 85, 24 | "TopicsArray": [ 25 | { 26 | "ID": 2465, 27 | "Topic": "Carbon Forum项目捐赠列表", 28 | "Tags": "捐赠", 29 | "UserID": 173, 30 | "UserName": "lincanbin", 31 | "LastName": "lincanbin", 32 | "LastTime": 1453885194, 33 | "Replies": 92 34 | }, 35 | { 36 | "ID": 2652, 37 | "Topic": "对程序有建议的,可以直接发主题,加“建议”标签", 38 | "Tags": "功能|建议|标签|程序", 39 | "UserID": 173, 40 | "UserName": "lincanbin", 41 | "LastName": "lincanbin", 42 | "LastTime": 1451314363, 43 | "Replies": 30 44 | }, 45 | { 46 | "ID": 2389, 47 | "Topic": "测试发帖回帖功能时,不要拍着键盘就发出来", 48 | "Tags": "Test|测试|话题", 49 | "UserID": 173, 50 | "UserName": "lincanbin", 51 | "LastName": "zhangzhg0508", 52 | "LastTime": 1448540419, 53 | "Replies": 173 54 | }, 55 | { 56 | "ID": 3340, 57 | "Topic": "hh", 58 | "Tags": "hh", 59 | "UserID": 173, 60 | "UserName": "lincanbin", 61 | "LastName": "lincanbin", 62 | "LastTime": 1447439151, 63 | "Replies": 2 64 | }, 65 | { 66 | "ID": 3338, 67 | "Topic": "弄", 68 | "Tags": "莫", 69 | "UserID": 173, 70 | "UserName": "lincanbin", 71 | "LastName": "lincanbin", 72 | "LastTime": 1447251326, 73 | "Replies": 4 74 | }, 75 | { 76 | "ID": 3032, 77 | "Topic": "Carbon Forum 3.6.5 发布,手机版重构大提速 & 新增QQ/微博登陆、话题广场、邮件取回密码等新功能……", 78 | "Tags": "Carbon Forum|更新", 79 | "UserID": 173, 80 | "UserName": "lincanbin", 81 | "LastName": "布拉皮特", 82 | "LastTime": 1447211465, 83 | "Replies": 85 84 | }, 85 | { 86 | "ID": 3225, 87 | "Topic": "又想起了有这么个坑没填了——Android客户端进度", 88 | "Tags": "Android|客户端|手机", 89 | "UserID": 173, 90 | "UserName": "lincanbin", 91 | "LastName": "admin222", 92 | "LastTime": 1447210367, 93 | "Replies": 25 94 | }, 95 | { 96 | "ID": 3339, 97 | "Topic": "454", 98 | "Tags": "测试", 99 | "UserID": 1750, 100 | "UserName": "lincanbin2", 101 | "LastName": "admin222", 102 | "LastTime": 1447210360, 103 | "Replies": 3 104 | }, 105 | { 106 | "ID": 3337, 107 | "Topic": "哦你", 108 | "Tags": "哦你|咯", 109 | "UserID": 173, 110 | "UserName": "lincanbin", 111 | "LastName": "", 112 | "LastTime": 1447157281, 113 | "Replies": 0 114 | }, 115 | { 116 | "ID": 3336, 117 | "Topic": "不", 118 | "Tags": "谷歌", 119 | "UserID": 173, 120 | "UserName": "lincanbin", 121 | "LastName": "", 122 | "LastTime": 1447092840, 123 | "Replies": 0 124 | }, 125 | { 126 | "ID": 3335, 127 | "Topic": "gggg", 128 | "Tags": "Test|功能|建议|话题", 129 | "UserID": 173, 130 | "UserName": "lincanbin", 131 | "LastName": "lincanbin", 132 | "LastTime": 1447092779, 133 | "Replies": 1 134 | }, 135 | { 136 | "ID": 3331, 137 | "Topic": "Cb123导航网专注免费收录Carbon Forum程序网站", 138 | "Tags": "导航|Cb123导航网", 139 | "UserID": 485, 140 | "UserName": "hlbj105", 141 | "LastName": "hlbj105", 142 | "LastTime": 1446950587, 143 | "Replies": 3 144 | }, 145 | { 146 | "ID": 3334, 147 | "Topic": "可以跟ecshop整合马?", 148 | "Tags": "论坛", 149 | "UserID": 801, 150 | "UserName": "qqnet", 151 | "LastName": "lincanbin", 152 | "LastTime": 1446912879, 153 | "Replies": 1 154 | }, 155 | { 156 | "ID": 3333, 157 | "Topic": "jing", 158 | "Tags": "图片|测试|垃圾信息", 159 | "UserID": 1746, 160 | "UserName": "hahaha123", 161 | "LastName": "", 162 | "LastTime": 1446906234, 163 | "Replies": 0 164 | }, 165 | { 166 | "ID": 3332, 167 | "Topic": "cf可否稳定常用?楼主基本小白,只玩过dz,但是越来越臃肿了···只需要交流,别的都是多余的", 168 | "Tags": "问题", 169 | "UserID": 1744, 170 | "UserName": "布鲁斯叔叔", 171 | "LastName": "布鲁斯叔叔", 172 | "LastTime": 1446899767, 173 | "Replies": 3 174 | }, 175 | { 176 | "ID": 2885, 177 | "Topic": "林先生今天找到女朋友了吗?", 178 | "Tags": "女朋友|打卡", 179 | "UserID": 173, 180 | "UserName": "lincanbin", 181 | "LastName": "lincanbin", 182 | "LastTime": 1446886895, 183 | "Replies": 161 184 | }, 185 | { 186 | "ID": 3329, 187 | "Topic": "我的话题数量一直 是1什么情况", 188 | "Tags": "问题|话题", 189 | "UserID": 1731, 190 | "UserName": "情趣", 191 | "LastName": "lincanbin", 192 | "LastTime": 1446875010, 193 | "Replies": 1 194 | }, 195 | { 196 | "ID": 3330, 197 | "Topic": "关于附件下载权限的问题", 198 | "Tags": "附件|权限|建议", 199 | "UserID": 1511, 200 | "UserName": "尤里卡", 201 | "LastName": "lincanbin", 202 | "LastTime": 1446874989, 203 | "Replies": 1 204 | }, 205 | { 206 | "ID": 3328, 207 | "Topic": "手机版和客户端版的贴内图片放大镜", 208 | "Tags": "建议", 209 | "UserID": 1738, 210 | "UserName": "simig", 211 | "LastName": "lincanbin", 212 | "LastTime": 1446814369, 213 | "Replies": 1 214 | }, 215 | { 216 | "ID": 3327, 217 | "Topic": "【问题】为什么有些帖子的内容在评论里显示了。", 218 | "Tags": "帖子|显示|评论|内容", 219 | "UserID": 1543, 220 | "UserName": "过客。", 221 | "LastName": "lincanbin", 222 | "LastTime": 1446730727, 223 | "Replies": 2 224 | } 225 | ] 226 | } 227 | ``` 228 | 229 | Fail: 230 | * This API does not throw an error now. 231 | -------------------------------------------------------------------------------- /login.md: -------------------------------------------------------------------------------- 1 | # Login 2 | 3 | ### HTTP request address 4 | `http://api.example.com/login` 5 | 6 | 7 | ### Menthod 8 | POST 9 | 10 | 11 | ### Notice 12 | You must first request the verification code(`http://api.example.com/seccode.php`), and save the Cookie in the HTTP Header that be returned by the verification code. 13 | 14 | This Cookie should be attached to the HTTP Header when you send the login parameters. 15 | 16 | 17 | ### Parameters 18 | Key|Value Type|Description|Obligatory|Default value 19 | ---|---|---|---|--- 20 | [API Authentication parameter](authentication.md#parameters)|||√| 21 | UserName|String|Username|√| 22 | Password|String(32)|md5(password)|√| 23 | VerifyCode|int(4)||√|null 24 | Expires|int(2)|The validity period of the token acquired. Default value is 30 days. |×|30 25 | 26 | 27 | ### HTTP Response 28 | Success: 29 | ```json 30 | { 31 | "Status": 1, 32 | "UserID": 173, 33 | "UserExpirationTime": 1450030066, 34 | "UserCode": "17cdbe3956a3b87428a080e5361f6f5e", 35 | "UserInfo": { 36 | "ID": 173, 37 | "UserName": "lincanbin", 38 | "UserRoleID": 5, 39 | "UserMail": "lincanbin@hotmail.com", 40 | "UserIntro": "一个穷人。" 41 | } 42 | } 43 | ``` 44 | 45 | Fail: 46 | ```json 47 | { 48 | "Status": 0, 49 | "ErrorCode": 101001, 50 | "ErrorMessage": "Forms can not be empty. " 51 | } 52 | ``` 53 | 54 | ### Error Code 55 | Error Code|Error Message 56 | ---|--- 57 | 101001|Forms can not be empty. 58 | 101002|Verification code error. 59 | 101003|User does not exist. 60 | 101004|Password error. 61 | 62 | 63 | ### User Authentication Parameters 64 | Key|Value Type|Description|Obligatory|Example 65 | ---|---|---|---|--- 66 | AuthUserID|int|UserID|√|173 67 | AuthUserExpirationTime|int(10)|The expiration time of these parameters. |√|1450030066 68 | AuthUserCode|String(32)|Access Token.|√|17cdbe3956a3b87428a080e5361f6f5e 69 | 70 | When the API requires user authentication, you need to send the following parameters. 71 | -------------------------------------------------------------------------------- /new.md: -------------------------------------------------------------------------------- 1 | # Create new topic 2 | 3 | ### HTTP request address 4 | `http://api.example.com/new` 5 | 6 | ### Menthod 7 | POST 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | [API Authentication parameter](authentication.md#parameters)|||√| 13 | [User Authentication parameter](login.md#user-authentication-parameters)|||√| 14 | Title|String||√| 15 | Tag[]|String|If you need to add a number of tags, you can call this parameter repeatedly.|√| 16 | Content|String||×|null 17 | 18 | 19 | ### HTTP Response 20 | Success: 21 | ```json 22 | { 23 | "Status": 1, 24 | "TopicID": 12450 25 | } 26 | ``` 27 | 28 | Fail: 29 | ```json 30 | { 31 | "Status": 0, 32 | "ErrorCode": 103001, 33 | "ErrorMessage": "Title can't be empty. " 34 | } 35 | ``` 36 | 37 | ### Error Code 38 | Error Code|Error Message 39 | ---|--- 40 | 103001|Title can't be empty 41 | 103002|Content is too long 42 | 103003|Tag can't be empty 43 | -------------------------------------------------------------------------------- /notifications.md: -------------------------------------------------------------------------------- 1 | # Get Notifications List 2 | 3 | ### HTTP request address 4 | `http://api.example.com/notifications` 5 | 6 | ### Menthod 7 | POST 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | [API Authentication parameter](authentication.md#parameters)|||√| 13 | [User Authentication parameter](login.md#user-authentication-parameters)|||√| 14 | 15 | 16 | ### HTTP Response 17 | Success: 18 | ```json 19 | 20 | ``` 21 | 22 | Fail: 23 | * This API does not throw an error now. 24 | -------------------------------------------------------------------------------- /register.md: -------------------------------------------------------------------------------- 1 | # Register 2 | 3 | ### HTTP request address 4 | `http://api.example.com/register` 5 | 6 | 7 | ### Menthod 8 | POST 9 | 10 | 11 | ### Notice 12 | You must first request the verification code(`http://api.example.com/seccode.php`), and save the Cookie in the HTTP Header that be returned by the verification code. 13 | 14 | This Cookie should be attached to the HTTP Header when you send the register parameters. 15 | 16 | 17 | ### Parameters 18 | Key|Value Type|Description|Obligatory|Default value 19 | ---|---|---|---|--- 20 | [API Authentication parameter](authentication.md#parameters)|||√| 21 | UserName|String|Username|√| 22 | Email|String|Email|√| 23 | Password|String(32)|md5(password)|√| 24 | VerifyCode|int(4)|Verification code|√|null 25 | 26 | 27 | ### HTTP Response 28 | Success: 29 | ```json 30 | { 31 | "Status": 1, 32 | "UserID": 173, 33 | "UserExpirationTime": 1450030066, 34 | "UserCode": "17cdbe3956a3b87428a080e5361f6f5e", 35 | "UserInfo": { 36 | "ID": 173, 37 | "UserName": "lincanbin", 38 | "UserRoleID": 5, 39 | "UserMail": "lincanbin@hotmail.com", 40 | "UserIntro": "一个穷人。" 41 | } 42 | } 43 | ``` 44 | 45 | Fail: 46 | ```json 47 | { 48 | "Status": 0, 49 | "ErrorCode": 104001, 50 | "ErrorMessage": "Forms can not be empty. " 51 | } 52 | ``` 53 | 54 | ### Error Code 55 | Error Code|Error Message 56 | ---|--- 57 | 104001|Forms can not be empty. 58 | 104002|Invalid username. 59 | 104003|Invalid Email. 60 | 104004|Verification code error. 61 | 104005|This username already exists. 62 | 63 | 64 | ### User Authentication Parameters 65 | Key|Value Type|Description|Obligatory|Example 66 | ---|---|---|---|--- 67 | AuthUserID|int|UserID|√|173 68 | AuthUserExpirationTime|int(10)|The expiration time of these parameters. |√|1450030066 69 | AuthUserCode|String(32)|Access Token.|√|17cdbe3956a3b87428a080e5361f6f5e 70 | 71 | When the API requires user authentication, you need to send the following parameters. 72 | -------------------------------------------------------------------------------- /reply.md: -------------------------------------------------------------------------------- 1 | # Reply to topic 2 | 3 | ### HTTP request address 4 | `http://api.example.com/reply` 5 | 6 | ### Menthod 7 | POST 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | [API Authentication parameter](authentication.md#parameters)|||√| 13 | [User Authentication parameter](login.md#user-authentication-parameters)|||√| 14 | TopicID|int||√|0 15 | Content|String||√|null 16 | 17 | 18 | ### HTTP Response 19 | Success: 20 | ```json 21 | { 22 | "Status": 1, 23 | "TopicID": 12, 24 | "PostID": 450, 25 | "Page": 1 /* Total page of this topic. */ 26 | } 27 | ``` 28 | 29 | Fail: 30 | ```json 31 | { 32 | "Status": 0, 33 | "ErrorCode": 102001, 34 | "ErrorMessage": "Content empty. " 35 | } 36 | ``` 37 | 38 | ### Error Code 39 | Error Code|Error Message 40 | ---|--- 41 | 102001|Content empty. 42 | 102002|Content is too long 43 | -------------------------------------------------------------------------------- /seccode.md: -------------------------------------------------------------------------------- 1 | # Get the Seccode Captcha 2 | 3 | ### HTTP request address 4 | `http://api.example.com/seccode.php` 5 | 6 | ### Menthod 7 | GET 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | - |-|No parameters needed here. | | 13 | 14 | 15 | ### HTTP Response 16 | Success: 17 | ``` 18 | Seccode response image data. Image size is 60*30. 19 | ``` 20 | 21 | Fail: 22 | * This API does not throw an error now. 23 | -------------------------------------------------------------------------------- /topic.md: -------------------------------------------------------------------------------- 1 | # Get the Topic Information and Replies 2 | 3 | ### HTTP request address 4 | `http://api.example.com/t/{{topic_id}}-{{page}}` 5 | 6 | ### Menthod 7 | GET 8 | 9 | ### Parameters 10 | Key|Value Type|Description|Obligatory|Default value 11 | ---|---|---|---|--- 12 | [API Authentication parameter](authentication.md#parameters)|||√| 13 | [User Authentication parameter](login.md#user-authentication-parameters)|||×| 14 | {{topic_id}}|int|Topic ID. This parameter should be constructed in the requests address. |√| 15 | {{page}}|int|Page number of the replies list. This parameter should be constructed in the requests address. |√| 16 | 17 | 18 | ### HTTP Response 19 | Success: 20 | ```json 21 | { 22 | "Status": 1, 23 | "Page": 1, 24 | "TotalPage": 2, 25 | "IsFavorite": 0, 26 | "TopicInfo": { 27 | "ID": 4015, 28 | "Topic": "我的DigitalOcean的VPS终于要退役了,用了一年。", 29 | "Tags": "DigitalOcean|VPS", 30 | "UserID": 173, 31 | "UserName": "lincanbin", 32 | "LastName": "jetereting", 33 | "PostTime": 1464833166, 34 | "LastTime": 1465216707, 35 | "IsGood": 0, 36 | "IsTop": 0, 37 | "IsLocked": 0, 38 | "IsDel": 0, 39 | "IsVote": 0, 40 | "Views": 225, 41 | "Replies": 24, 42 | "RatingSum": 0, 43 | "TotalRatings": 0, 44 | "LastViewedTime": 1465244974, 45 | "PostsTableName": null, 46 | "ThreadStyle": "", 47 | "Lists": "", 48 | "ListsTime": 1464833166, 49 | "Log": "", 50 | "Favorites": 0 51 | }, 52 | "PostsArray": [ 53 | { 54 | "ID": 16952, 55 | "TopicID": 4015, 56 | "UserID": 173, 57 | "UserName": "lincanbin", 58 | "Content": "
打完这个Snapshot就Destroy,毕竟没钱了。
", 59 | "PostTime": 1464833166, 60 | "IsDel": 0, 61 | "PostFloor": 0 62 | }, 63 | { 64 | "ID": 16953, 65 | "TopicID": 4015, 66 | "UserID": 3646, 67 | "UserName": "hulu", 68 | "Content": "我觉得IBM的bluemix不错,免费配额也够用了。\n可以试试
", 69 | "PostTime": 1464835043, 70 | "IsDel": 0, 71 | "PostFloor": 1 72 | }, 73 | { 74 | "ID": 16954, 75 | "TopicID": 4015, 76 | "UserID": 173, 77 | "UserName": "lincanbin", 78 | "Content": "回复#1 @hulu :
我比较挑线路,还需要比较高的自由度。
", 79 | "PostTime": 1464835077, 80 | "IsDel": 0, 81 | "PostFloor": 2 82 | }, 83 | { 84 | "ID": 16956, 85 | "TopicID": 4015, 86 | "UserID": 2530, 87 | "UserName": "ivanilla", 88 | "Content": "核电
好像不止一年,是一年半了。
", 99 | "PostTime": 1464845195, 100 | "IsDel": 0, 101 | "PostFloor": 4 102 | }, 103 | { 104 | "ID": 16969, 105 | "TopicID": 4015, 106 | "UserID": 2498, 107 | "UserName": "chenxi", 108 | "Content": "新的VPS什么配置?内存多大?
", 109 | "PostTime": 1464863372, 110 | "IsDel": 0, 111 | "PostFloor": 5 112 | }, 113 | { 114 | "ID": 16970, 115 | "TopicID": 4015, 116 | "UserID": 173, 117 | "UserName": "lincanbin", 118 | "Content": "\n回复 #0 @chenxi :
\n
一个月900日元,1G内存,2核CPU。
\n", 119 | "PostTime": 1464863407, 120 | "IsDel": 0, 121 | "PostFloor": 6 122 | }, 123 | { 124 | "ID": 16971, 125 | "TopicID": 4015, 126 | "UserID": 2498, 127 | "UserName": "chenxi", 128 | "Content": "回复#6 @lincanbin :
那鲁好道!
", 129 | "PostTime": 1464863583, 130 | "IsDel": 0, 131 | "PostFloor": 7 132 | }, 133 | { 134 | "ID": 16972, 135 | "TopicID": 4015, 136 | "UserID": 173, 137 | "UserName": "lincanbin", 138 | "Content": "\n回复 #0 @chenxi :
\n
真贵啊。
\n", 139 | "PostTime": 1464863704, 140 | "IsDel": 0, 141 | "PostFloor": 8 142 | }, 143 | { 144 | "ID": 16973, 145 | "TopicID": 4015, 146 | "UserID": 2498, 147 | "UserName": "chenxi", 148 | "Content": "回复#8 @lincanbin :
对日本人来说,900日元就是一顿午饭钱
", 149 | "PostTime": 1464863814, 150 | "IsDel": 0, 151 | "PostFloor": 9 152 | }, 153 | { 154 | "ID": 16974, 155 | "TopicID": 4015, 156 | "UserID": 173, 157 | "UserName": "lincanbin", 158 | "Content": "\n回复 #0 @chenxi :
\n
对我来说是很多顿
\n", 159 | "PostTime": 1464863890, 160 | "IsDel": 0, 161 | "PostFloor": 10 162 | }, 163 | { 164 | "ID": 16975, 165 | "TopicID": 4015, 166 | "UserID": 2498, 167 | "UserName": "chenxi", 168 | "Content": "回复#10 @lincanbin :
你和你女朋友吃顿肯德基也差不多没了。
楼主回复的帖子全部显示 【回复 #0】 吗?
", 169 | "PostTime": 1464864228, 170 | "IsDel": 0, 171 | "PostFloor": 11 172 | }, 173 | { 174 | "ID": 16976, 175 | "TopicID": 4015, 176 | "UserID": 173, 177 | "UserName": "lincanbin", 178 | "Content": "\n回复 #11 @chenxi :
\n
因为是用客户端
\n", 179 | "PostTime": 1464864270, 180 | "IsDel": 0, 181 | "PostFloor": 12 182 | }, 183 | { 184 | "ID": 16977, 185 | "TopicID": 4015, 186 | "UserID": 2498, 187 | "UserName": "chenxi", 188 | "Content": "硬盘多大的?
", 189 | "PostTime": 1464864280, 190 | "IsDel": 0, 191 | "PostFloor": 13 192 | }, 193 | { 194 | "ID": 16978, 195 | "TopicID": 4015, 196 | "UserID": 173, 197 | "UserName": "lincanbin", 198 | "Content": "\n回复 #11 @chenxi :
\n
客户端直接在提醒页回复就这样。
\n", 199 | "PostTime": 1464864288, 200 | "IsDel": 0, 201 | "PostFloor": 14 202 | }, 203 | { 204 | "ID": 16979, 205 | "TopicID": 4015, 206 | "UserID": 173, 207 | "UserName": "lincanbin", 208 | "Content": "\n回复 #13 @chenxi :
\n
50G
\n", 209 | "PostTime": 1464864298, 210 | "IsDel": 0, 211 | "PostFloor": 15 212 | }, 213 | { 214 | "ID": 16980, 215 | "TopicID": 4015, 216 | "UserID": 173, 217 | "UserName": "lincanbin", 218 | "Content": "\n回复 #11 @chenxi :
\n
我从来都是自己一个人出去吃饭的,跟女朋友一起吃这种事,大概只能在梦里有了。
\n", 219 | "PostTime": 1464864359, 220 | "IsDel": 0, 221 | "PostFloor": 16 222 | }, 223 | { 224 | "ID": 16981, 225 | "TopicID": 4015, 226 | "UserID": 2498, 227 | "UserName": "chenxi", 228 | "Content": "回复#16 @lincanbin :
好吧,我是说你的右手。。。
", 229 | "PostTime": 1464864467, 230 | "IsDel": 0, 231 | "PostFloor": 17 232 | }, 233 | { 234 | "ID": 16982, 235 | "TopicID": 4015, 236 | "UserID": 173, 237 | "UserName": "lincanbin", 238 | "Content": "\n回复 #17 @chenxi :
\n
你怎么知道我用右手…
\n", 239 | "PostTime": 1464864641, 240 | "IsDel": 0, 241 | "PostFloor": 18 242 | }, 243 | { 244 | "ID": 16983, 245 | "TopicID": 4015, 246 | "UserID": 2498, 247 | "UserName": "chenxi", 248 | "Content": "回复#18 @lincanbin :
\n\n看你打的字,键盘右手侧敲出来的字母明显比左边的字母颜色深很多,所以断定你右手已经不经意间练的很粗壮了。。。hoho
", 249 | "PostTime": 1464866458, 250 | "IsDel": 0, 251 | "PostFloor": 19 252 | } 253 | ] 254 | } 255 | ``` 256 | 257 | Fail: 258 | ```json 259 | "Status": 0, 260 | "ErrorCode": 404, 261 | "ErrorMessage": "404 Not Found" 262 | ``` 263 | --------------------------------------------------------------------------------