diff --git a/docs/JCS_pub_API.md b/docs/JCS_pub_API.md index dcf31b0..e3c5ff8 100644 --- a/docs/JCS_pub_API.md +++ b/docs/JCS_pub_API.md @@ -47,38 +47,7 @@ - ### 1.2 根据名字查询桶 @@ -109,8 +78,140 @@ ### 3.1 批量上传对象 + + + + + + + + + + + + + + + + + + + + + + + +
请求
POSTmultipart/form-data; boundary=xxxxxxx/v1/object/upload
Query
Body + 被boundary分隔的多个part,第一个part的name必须是info,格式如下: +
{
+  "packageID": 1, // PackageID,使用从创建Package接口返回的ID
+  "affinity": 1 // 文件优先上传到哪个存储空间,可以不填。
+}
+ 之后的每一个part都是一个文件,name为files,filename为文件路径,需要进行URL编码。 + 一个例子: +
POST /object/upload HTTP/1.1
+User-Agent: PostmanRuntime/7.29.0
+Accept: */*
+Postman-Token: c12fa8b5-d902-46f3-b104-028effa0d531
+Host: localhost:7890
+Accept-Encoding: gzip, deflate, br
+Connection: keep-alive
+Content-Type: multipart/form-data; boundary=--------------------------818270992847011232305151
+Content-Length: 1649
+
+----------------------------818270992847011232305151
+Content-Disposition: form-data; name="info"
+
+{
+	"userID": 1,
+	"packageID": 1
+}
+----------------------------818270992847011232305151
+Content-Disposition: form-data; name="files"; filename="test.txt"
+Content-Type: text/plain
+
+testdata
+----------------------------818270992847011232305151
+Content-Disposition: form-data; name="files"; filename="a%2Fb%2Ftest2.txt"
+Content-Type: text/plain
+
+testdata2
+----------------------------818270992847011232305151--
+
响应示例
+
{
+    "code": "OK",
+    "message": "",
+    "data": {
+        "uploadeds": [
+            {
+                "objectID": 7,
+                "packageID": 1,
+                "path": "test.txt",
+                "size": "123456",
+                "fileHash": "xxxxxxxxxx",
+                "redundancy": {
+                    "type": "none"
+                },
+                "createTime": "2024-11-05T11:06:28+08:00",
+                "updateTime": "2025-01-10T09:15:39.4452196+08:00"
+            },
+            {
+                "objectID": 8,
+                "packageID": 1,
+                "path": "a/b/test2.txt",
+                "size": "123456",
+                "fileHash": "xxxxxxxxxx",
+                "redundancy": {
+                    "type": "none"
+                },
+                "createTime": "2024-11-05T11:06:28+08:00",
+                "updateTime": "2025-01-10T09:15:39.4452196+08:00"
+            }
+        ]
+    }
+}
+
+ ### 3.2 下载对象 + + + + + + + + + + + + + + + + + + + + + + + +
请求
GETapplication/json/v1/bucket/download
Query +
● objectID:int64
+● offset:int64,偏移量
+● length:int64,读取长度。不存在则读取整个对象
+
Body
响应示例
+ 如果请求成功,那么Content-Type将会是application/octet-stream,响应体就是文件数据。 + 如果失败,那么Content-Type将会是application/json,响应体格式如下: +
{
+    "code": "OperationFailed",
+    "message": "xxxxxxxx",
+    "data": null
+}
+
+ + ### 3.3 根据路径下载对象 @@ -156,5 +257,36 @@ ### 5.3 取消同步任务 +