| 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"
}
]
}
}
|