You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

JCS_pub_API.md 6.3 kB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. # JCS-pub API
  2. **跳转回README.md [中文](../README.md) [英文](../README_en.md)**
  3. ## 1 桶相关
  4. ### 1.1 创建桶
  5. <table class="api-doc-table" >
  6. <tr>
  7. <th colspan="3">请求</th>
  8. </tr>
  9. <tr>
  10. <td>POST</td>
  11. <td>application/json</td>
  12. <td>/v1/bucket/create</td>
  13. </tr>
  14. <tr>
  15. <td>Query</td>
  16. <td colspan="2">无</td>
  17. </tr>
  18. <tr>
  19. <td>Body</td>
  20. <td colspan="2">
  21. <pre>{
  22. "userID": 1,
  23. "name": "bkt1" //桶名
  24. }</pre>
  25. </td>
  26. </tr>
  27. <tr>
  28. <th colspan="3">响应示例</th>
  29. </tr>
  30. <tr>
  31. <td colspan="3">
  32. <pre>{
  33. "code": "OK",
  34. "message": "",
  35. "data": {
  36. "bucket": {
  37. "bucketID": 1, // 桶ID
  38. "name": "bkt1" // 桶名
  39. }
  40. }
  41. }</pre>
  42. </td>
  43. </tr>
  44. </table>
  45. ### 1.2 根据名字查询桶
  46. ### 1.3 查询所有桶
  47. ### 1.4 删除桶
  48. ## 2 包相关
  49. ### 2.1 创建包
  50. ### 2.2 根据桶名和包名查询包
  51. ### 2.3 获取桶里所有的包
  52. ### 2.4 删除包
  53. ## 3 对象相关
  54. ### 3.1 批量上传对象
  55. <table class="api-doc-table" >
  56. <tr>
  57. <th colspan="3">请求</th>
  58. </tr>
  59. <tr>
  60. <td>POST</td>
  61. <td>multipart/form-data; boundary=xxxxxxx</td>
  62. <td>/v1/object/upload</td>
  63. </tr>
  64. <tr>
  65. <td>Query</td>
  66. <td colspan="2">无</td>
  67. </tr>
  68. <tr>
  69. <td>Body</td>
  70. <td colspan="2">
  71. <p>被boundary分隔的多个part,第一个part的name必须是info,格式如下:</p>
  72. <pre>{
  73. "packageID": 1, // PackageID,使用从创建Package接口返回的ID
  74. "affinity": 1 // 文件优先上传到哪个存储空间,可以不填。
  75. }</pre>
  76. <p>之后的每一个part都是一个文件,name为files,filename为文件路径,需要进行URL编码。</p>
  77. <p>一个例子:</p>
  78. <pre>POST /object/upload HTTP/1.1
  79. User-Agent: PostmanRuntime/7.29.0
  80. Accept: */*
  81. Postman-Token: c12fa8b5-d902-46f3-b104-028effa0d531
  82. Host: localhost:7890
  83. Accept-Encoding: gzip, deflate, br
  84. Connection: keep-alive
  85. Content-Type: multipart/form-data; boundary=--------------------------818270992847011232305151
  86. Content-Length: 1649
  87. <span style="display:block; height:1em;"></span>
  88. <mark>----------------------------818270992847011232305151</mark>
  89. Content-Disposition: form-data; name="info"
  90. <span style="display:block; height:1em;"></span>
  91. {
  92. "userID": 1,
  93. "packageID": 1
  94. }
  95. <mark>----------------------------818270992847011232305151</mark>
  96. Content-Disposition: form-data; name="files"; filename="test.txt"
  97. Content-Type: text/plain
  98. <span style="display:block; height:1em;"></span>
  99. testdata
  100. <mark>----------------------------818270992847011232305151</mark>
  101. Content-Disposition: form-data; name="files"; filename="a%2Fb%2Ftest2.txt"
  102. Content-Type: text/plain
  103. <span style="display:block; height:1em;"></span>
  104. testdata2
  105. <mark>----------------------------818270992847011232305151--</mark></pre>
  106. </td>
  107. </tr>
  108. <tr>
  109. <th colspan="3">响应示例</th>
  110. </tr>
  111. <tr>
  112. <td colspan="3">
  113. <pre>{
  114. "code": "OK",
  115. "message": "",
  116. "data": {
  117. "uploadeds": [
  118. {
  119. "objectID": 7,
  120. "packageID": 1,
  121. "path": "test.txt",
  122. "size": "123456",
  123. "fileHash": "xxxxxxxxxx",
  124. "redundancy": {
  125. "type": "none"
  126. },
  127. "createTime": "2024-11-05T11:06:28+08:00",
  128. "updateTime": "2025-01-10T09:15:39.4452196+08:00"
  129. },
  130. {
  131. "objectID": 8,
  132. "packageID": 1,
  133. "path": "a/b/test2.txt",
  134. "size": "123456",
  135. "fileHash": "xxxxxxxxxx",
  136. "redundancy": {
  137. "type": "none"
  138. },
  139. "createTime": "2024-11-05T11:06:28+08:00",
  140. "updateTime": "2025-01-10T09:15:39.4452196+08:00"
  141. }
  142. ]
  143. }
  144. }</pre>
  145. </td>
  146. </tr>
  147. </table>
  148. ### 3.2 下载对象
  149. <table class="api-doc-table" >
  150. <tr>
  151. <th colspan="3">请求</th>
  152. </tr>
  153. <tr>
  154. <td>GET</td>
  155. <td>application/json</td>
  156. <td>/v1/bucket/download</td>
  157. </tr>
  158. <tr>
  159. <td>Query</td>
  160. <td colspan="2">
  161. <pre>● objectID:int64
  162. ● offset:int64,偏移量
  163. ● length:int64,读取长度。不存在则读取整个对象</pre>
  164. </td>
  165. </tr>
  166. <tr>
  167. <td>Body</td>
  168. <td colspan="2">无</td>
  169. </tr>
  170. <tr>
  171. <th colspan="3">响应示例</th>
  172. </tr>
  173. <tr>
  174. <td colspan="3">
  175. 如果请求成功,那么Content-Type将会是application/octet-stream,响应体就是文件数据。
  176. 如果失败,那么Content-Type将会是application/json,响应体格式如下:
  177. <pre>{
  178. "code": "OperationFailed",
  179. "message": "xxxxxxxx",
  180. "data": null
  181. }</pre>
  182. </td>
  183. </tr>
  184. </table>
  185. ### 3.3 根据路径下载对象
  186. ### 3.4 根据路径查询对象
  187. ### 3.5 获取包中所有的对象
  188. ### 3.6 批量移动对象
  189. ### 3.7 批量删除对象
  190. ### 3.8 批量复制对象
  191. ### 3.9 创建分片上传对象
  192. ### 3.10 上传分片
  193. ### 3.11 合并分片
  194. ## 4 用户存储空间相关
  195. ### 4.1 创建用户存储空间配置
  196. ### 4.2 更新用户存储空间配置
  197. ### 4.3 删除用户存储空间配置
  198. ### 4.4 获取用户存储空间配置
  199. ### 4.5 测试用户存储空间配置
  200. ### 4.6 从用户存储空间上传到一个新的包
  201. ### 4.7 下载一个包到用户存储空间
  202. ## 5 用户存储空间同步相关
  203. ### 5.1 创建同步任务
  204. ### 5.2 获取同步任务
  205. ### 5.3 取消同步任务
  206. <style>
  207. .api-doc-table {
  208. border-collapse: collapse;
  209. width: 100%;
  210. font-family: monospace;
  211. border: 1px solid #e1e4e8;
  212. }
  213. .api-doc-table th {
  214. background-color: #f6f8fa;
  215. text-align: center;
  216. font-weight: 600;
  217. padding: 8px 12px;
  218. }
  219. .api-doc-table td {
  220. padding: 8px 12px;
  221. border-top: 1px solid #eaecef;
  222. background-color: #ffffff;
  223. }
  224. .api-doc-table td:first-child {
  225. font-weight: bold;
  226. }
  227. /* .api-doc-table pre {
  228. margin: 0;
  229. font-family: monospace;
  230. font-size: 14px;
  231. line-height: 1.5;
  232. } */
  233. </style>

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。