更新时间:2024-10-25 GMT+08:00
分享

获取上传链接

功能介绍

获取文件分片的上传链接。

URI

POST /koodrive/ose/v1/files/multipart/uploadUrl

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

fileId

String

文件id

multiParts

Array of MultiPartInfo objects

分片信息列表

表2 MultiPartInfo

参数

是否必选

参数类型

描述

partNumber

Integer

分片编号

partSize

Long

分片长度,取值范围[5242880, 5368709120],最后一个分片取值范围[0, 5368709120]

minimum: 0

maximum: 5368709120

partOffset

Long

到上一个数据块为止的总长度,单位为字节,该字段仅在分片并行上传时有效,分片并行上传时,除最后一个分片外,分片并行上传的其它分片大小,必须是 64字节的倍数

hashCtx

Array of longs

用于迭代计算SHA256的上下文,该字段仅在分片并行上传时有效。对于SHA1,取值为上一个数据块SHA1的第1-5个32位变量。对于SHA256,取值为上一个数据块SHA256的第1-8个32位变量。

注:分片并行上传时除第一个分片外其他分片必填。

uploadUrl

String

文件上传的URL,返回参数

partId

String

分片对象ID

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

multiParts

Array of MultiPartInfo objects

分片信息

code

Integer

响应码

msg

String

响应消息

表4 MultiPartInfo

参数

参数类型

描述

partNumber

Integer

分片编号

partSize

Long

分片长度,取值范围[5242880, 5368709120],最后一个分片取值范围[0, 5368709120]

minimum: 0

maximum: 5368709120

partOffset

Long

到上一个数据块为止的总长度,单位为字节,该字段仅在分片并行上传时有效,分片并行上传时,除最后一个分片外,分片并行上传的其它分片大小,必须是 64字节的倍数

hashCtx

Array of longs

用于迭代计算SHA256的上下文,该字段仅在分片并行上传时有效。对于SHA1,取值为上一个数据块SHA1的第1-5个32位变量。对于SHA256,取值为上一个数据块SHA256的第1-8个32位变量。

注:分片并行上传时除第一个分片外其他分片必填。

uploadUrl

String

文件上传的URL,返回参数

partId

String

分片对象ID

请求示例

通过“分片上传”方式创建文件元数据,该示例指定了对应文件从46到50分片的分片,后续响应会返回对应分片的上传地址,需要将对应分片通过PUT请求上传对应的分片。

POST /koodrive/ose/v1/files/multipart/uploadUrl

Authorization:Bearer+10f88*********4791e9ff
{
	"fileId": "Fqo2kYHmsgWg5whxzYHZLL7mebXbBr1no",
	"multiParts": [
		{
			"hashCtx": [
				1748048713,
				2644528514,
				4267727253,
				2252747490,
				4036182088,
				2253856463,
				526139147,
				2194267752
			],
			"partNumber": 46,
			"partOffset": 471859200,
			"partSize": 10485760
		},
		{
			"hashCtx": [
				1606212,
				1743131457,
				2392241618,
				605997363,
				3054356113,
				673008609,
				3509469858,
				2186398707
			],
			"partNumber": 47,
			"partOffset": 482344960,
			"partSize": 10485760
		},
		{
			"hashCtx": [
				3734586607,
				1407828785,
				3243195625,
				3451635323,
				4031416500,
				3005674269,
				2829389145,
				3478923465
			],
			"partNumber": 48,
			"partOffset": 492830720,
			"partSize": 10485760
		},
		{
			"hashCtx": [
				3677016828,
				906610338,
				3389225168,
				2507561547,
				1134075905,
				3951513567,
				1673174790,
				3034719756
			],
			"partNumber": 49,
			"partOffset": 503316480,
			"partSize": 10485760
		},
		{
			"hashCtx": [
				1827691250,
				2956926651,
				1801460777,
				4119662276,
				4162375117,
				187866976,
				1789369655,
				278284511
			],
			"partNumber": 50,
			"partOffset": 513802240,
			"partSize": 10485760
		}
	]
}

响应示例

状态码: 200

对应分片的上传信息

{
  "multiParts" : [ {
    "partNumber" : 46,
    "partSize" : 10485760,
    "partOffset" : 471859200,
    "hashCtx" : [ 1748048713, 2644528514, 4267727253, 2252747490, 4036182088, 2253856463, 526139147, 2194267752 ],
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/4e8108ee15fa471cbe5f18f03e8b555b086?partNumber=46&uploadId=0000019039E1E8520006EBE63B492EDB&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240621T082041Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240621%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Iteration-Hash-Ctx=eyJtZF9sZW4iOjMyLCJudW0iOjAsImgiOlsxNzQ4MDQ4NzEzLDI2NDQ1Mjg1MTQsNDI2NzcyNzI1MywyMjUyNzQ3NDkwLDQwMzYxODIwODgsMjI1Mzg1NjQ2Myw1MjYxMzkxNDcsMjE5NDI2Nzc1Ml0sIm5oIjowLCJubCI6Mzc3NDg3MzYwMCwiaGFzaF90eXBlIjoic2hhMjU2In0%3D&X-Amz-Signature=d3e7f60f45c8fd3960e697c57bb7d1c386dd20940b860fd976ba77425767d65e"
  }, {
    "partNumber" : 47,
    "partSize" : 10485760,
    "partOffset" : 482344960,
    "hashCtx" : [ 1606212, 1743131457, 2392241618, 605997363, 3054356113, 673008609, 3509469858, 2186398707 ],
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/4e8108ee15fa471cbe5f18f03e8b555b086?partNumber=47&uploadId=0000019039E1E8520006EBE63B492EDB&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240621T082041Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240621%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Iteration-Hash-Ctx=eyJtZF9sZW4iOjMyLCJudW0iOjAsImgiOlsxNjA2MjEyLDE3NDMxMzE0NTcsMjM5MjI0MTYxOCw2MDU5OTczNjMsMzA1NDM1NjExMyw2NzMwMDg2MDksMzUwOTQ2OTg1OCwyMTg2Mzk4NzA3XSwibmgiOjAsIm5sIjozODU4NzU5NjgwLCJoYXNoX3R5cGUiOiJzaGEyNTYifQ%3D%3D&X-Amz-Signature=38980d3be00e528ee11c366ae69e950d673528203f3869a26f39dae42b4dabbb"
  }, {
    "partNumber" : 48,
    "partSize" : 10485760,
    "partOffset" : 492830720,
    "hashCtx" : [ 3734586607, 1407828785, 3243195625, 3451635323, 4031416500, 3005674269, 2829389145, 3478923465 ],
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/4e8108ee15fa471cbe5f18f03e8b555b086?partNumber=48&uploadId=0000019039E1E8520006EBE63B492EDB&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240621T082041Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240621%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Iteration-Hash-Ctx=eyJtZF9sZW4iOjMyLCJudW0iOjAsImgiOlszNzM0NTg2NjA3LDE0MDc4Mjg3ODUsMzI0MzE5NTYyNSwzNDUxNjM1MzIzLDQwMzE0MTY1MDAsMzAwNTY3NDI2OSwyODI5Mzg5MTQ1LDM0Nzg5MjM0NjVdLCJuaCI6MCwibmwiOjM5NDI2NDU3NjAsImhhc2hfdHlwZSI6InNoYTI1NiJ9&X-Amz-Signature=d5608f38d6afdfee117be1243870b63f46ff11676633e0630d122f0c4145e8ae"
  }, {
    "partNumber" : 49,
    "partSize" : 10485760,
    "partOffset" : 503316480,
    "hashCtx" : [ 3677016828, 906610338, 3389225168, 2507561547, 1134075905, 3951513567, 1673174790, 3034719756 ],
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/4e8108ee15fa471cbe5f18f03e8b555b086?partNumber=49&uploadId=0000019039E1E8520006EBE63B492EDB&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240621T082041Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240621%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Iteration-Hash-Ctx=eyJtZF9sZW4iOjMyLCJudW0iOjAsImgiOlszNjc3MDE2ODI4LDkwNjYxMDMzOCwzMzg5MjI1MTY4LDI1MDc1NjE1NDcsMTEzNDA3NTkwNSwzOTUxNTEzNTY3LDE2NzMxNzQ3OTAsMzAzNDcxOTc1Nl0sIm5oIjowLCJubCI6NDAyNjUzMTg0MCwiaGFzaF90eXBlIjoic2hhMjU2In0%3D&X-Amz-Signature=52eb71278fc9310f13a5b92641b5a726d0006be8dd89a242f9c4ce09c360e1f7"
  }, {
    "partNumber" : 50,
    "partSize" : 10485760,
    "partOffset" : 513802240,
    "hashCtx" : [ 1827691250, 2956926651, 1801460777, 4119662276, 4162375117, 187866976, 1789369655, 278284511 ],
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/4e8108ee15fa471cbe5f18f03e8b555b086?partNumber=50&uploadId=0000019039E1E8520006EBE63B492EDB&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240621T082041Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240621%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Iteration-Hash-Ctx=eyJtZF9sZW4iOjMyLCJudW0iOjAsImgiOlsxODI3NjkxMjUwLDI5NTY5MjY2NTEsMTgwMTQ2MDc3Nyw0MTE5NjYyMjc2LDQxNjIzNzUxMTcsMTg3ODY2OTc2LDE3ODkzNjk2NTUsMjc4Mjg0NTExXSwibmgiOjAsIm5sIjo0MTEwNDE3OTIwLCJoYXNoX3R5cGUiOiJzaGEyNTYifQ%3D%3D&X-Amz-Signature=154bcd4ad7774f20e196666d403bf3d4359dd151b9cb1cc1f604c6517c4a287b"
  } ],
  "code" : 0,
  "msg" : "成功"
}

状态码

状态码

描述

200

对应分片的上传信息

相关文档