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.6 kB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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编码。
  77. 一个例子:</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=&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;818270992847011232305151
  86. Content-Length: 1649
  87. <span></span>
  88. &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;818270992847011232305151
  89. Content-Disposition: form-data; name="info"
  90. <span></span>
  91. {
  92. "userID": 1,
  93. "packageID": 1
  94. }
  95. &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;818270992847011232305151
  96. Content-Disposition: form-data; name="files"; filename="test.txt"
  97. Content-Type: text/plain
  98. <span></span>
  99. testdata
  100. &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;818270992847011232305151
  101. Content-Disposition: form-data; name="files"; filename="a%2Fb%2Ftest2.txt"
  102. <span></span>
  103. testdata2
  104. &#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;818270992847011232305151&#45;&#45;</pre>
  105. </td>
  106. </tr>
  107. <tr>
  108. <th colspan="3">响应示例</th>
  109. </tr>
  110. <tr>
  111. <td colspan="3">
  112. <pre>{
  113. "code": "OK",
  114. "message": "",
  115. "data": {
  116. "uploadeds": [
  117. {
  118. "objectID": 7,
  119. "packageID": 1,
  120. "path": "test.txt",
  121. "size": "123456",
  122. "fileHash": "xxxxxxxxxx",
  123. "redundancy": {
  124. "type": "none"
  125. },
  126. "createTime": "2024-11-05T11:06:28+08:00",
  127. "updateTime": "2025-01-10T09:15:39.4452196+08:00"
  128. },
  129. {
  130. "objectID": 8,
  131. "packageID": 1,
  132. "path": "a/b/test2.txt",
  133. "size": "123456",
  134. "fileHash": "xxxxxxxxxx",
  135. "redundancy": {
  136. "type": "none"
  137. },
  138. "createTime": "2024-11-05T11:06:28+08:00",
  139. "updateTime": "2025-01-10T09:15:39.4452196+08:00"
  140. }
  141. ]
  142. }
  143. }</pre>
  144. </td>
  145. </tr>
  146. </table>
  147. ### 3.2 下载对象
  148. <table class="api-doc-table" >
  149. <tr>
  150. <th colspan="3">请求</th>
  151. </tr>
  152. <tr>
  153. <td>GET</td>
  154. <td>application/json</td>
  155. <td>/v1/bucket/download</td>
  156. </tr>
  157. <tr>
  158. <td>Query</td>
  159. <td colspan="2">
  160. <p> &#45; objectID:int64
  161. &#45; offset:int64,偏移量
  162. &#45; length:int64,读取长度。不存在则读取整个对象 </p>
  163. </td>
  164. </tr>
  165. <tr>
  166. <td>Body</td>
  167. <td colspan="2">无</td>
  168. </tr>
  169. <tr>
  170. <th colspan="3">响应示例</th>
  171. </tr>
  172. <tr>
  173. <td colspan="3">
  174. <p>如果请求成功,那么Content-Type将会是application/octet-stream,响应体就是文件数据。
  175. 如果失败,那么Content-Type将会是application/json,响应体格式如下:</p>
  176. <pre>{
  177. "code": "OperationFailed",
  178. "message": "xxxxxxxx",
  179. "data": null
  180. }</pre>
  181. </td>
  182. </tr>
  183. </table>
  184. ### 3.3 根据路径下载对象
  185. ### 3.4 根据路径查询对象
  186. ### 3.5 获取包中所有的对象
  187. ### 3.6 批量移动对象
  188. ### 3.7 批量删除对象
  189. ### 3.8 批量复制对象
  190. ### 3.9 创建分片上传对象
  191. ### 3.10 上传分片
  192. ### 3.11 合并分片
  193. ## 4 用户存储空间相关
  194. ### 4.1 创建用户存储空间配置
  195. ### 4.2 更新用户存储空间配置
  196. ### 4.3 删除用户存储空间配置
  197. ### 4.4 获取用户存储空间配置
  198. ### 4.5 测试用户存储空间配置
  199. ### 4.6 从用户存储空间上传到一个新的包
  200. ### 4.7 下载一个包到用户存储空间
  201. ## 5 用户存储空间同步相关
  202. ### 5.1 创建同步任务
  203. ### 5.2 获取同步任务
  204. ### 5.3 取消同步任务
  205. <style>
  206. .api-doc-table {
  207. border-collapse: collapse;
  208. width: 100%;
  209. font-family: monospace;
  210. border: 1px solid #e1e4e8;
  211. }
  212. .api-doc-table th {
  213. background-color: #f6f8fa;
  214. text-align: center;
  215. font-weight: 600;
  216. padding: 8px 12px;
  217. }
  218. .api-doc-table td {
  219. background-color: #ffffff;
  220. }
  221. .api-doc-table tr:not(:last-child) td:first-child {
  222. font-weight: bold;
  223. }
  224. .api-doc-table p {
  225. margin: 0 0;
  226. line-height: 1.1;
  227. }
  228. </style>

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