目录

图片上传

该接口用于获取上传图片到文件服务器的参数,得到图片的唯一标志imageId,拿到上传参数后需要自行上传图片到文件服务器,上传方法参照“上传文件”。

Scope:https://www.huawei.com/contentconnect/video

图片文件要求:

请求地址

POST /mosopenapi/v2/foruser/image/upload

请求参数说明

参数名称

参数类型

参数描述

参数示例

是否必须

upResourceId

string

UP主的id标识,upResourceId和tpUserCode不能同时为空。

492456389055106944

为/list/users接口获取的upInfos中的upResourceId。

false

tpUserCode

string

UP主的第三方标识,upResourceId和tpUserCode不能同时为空。

hwvrmgjxmt

false

fileName

string

文件名称,必须带文件后缀,后缀仅支持jpg和png。

123.jpg

true

sha256

string

文件生成的签名,签名生成算法参见“算法介绍”。

34b234424d98dcb064a71a862835527ff3b5d38ec06cd98a3289c0028108322f

true

length

string

文件大小,单位为Bytes。

1024

true

请求样例

{
  "upResourceId": "674482848291436800",
  "fileName": "OpenAPI图片上传测试横版图片.jpg",
  "sha256": "3546fb7a0c8df3be7c0f48f1312d61b7955411655ae62d694840a83132f1f779",
  "length": "547582"
}

响应参数

参数字段

参数类型

参数描述

参数示例

是否必须

imageId

string

图片唯一id。

492456389055106956

true

url

string

上传地址。

https://hicinema-mmpmedia-test-cn.obs.cn-north-1.myhuaweicloud.com/contentsrc/import/CP180160618779129168/mos/part/1010b218-2e65-46bb-8a98-4180870e514c.jpg

true

method

string

上传方法。

PUT

true

header

{}

Authorization

string

请求三方厂商的签名信息。

AWS4-HMAC-SHA256 Credential=I06FNCS2OGN5YXWTTPZC/20220126/cn-north-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=50ac861f86da241b6ccfa092dd2fb93a67324d42cda2be7c55dcdc4cecb7c02a

true

x-amz-content-sha256

string

hws和amazon请求的body的sha256值。

c9e47948c5ab7b1e294279c9ec2d371ce8f75883b27cf97634adf552e4075ab7

true

x-amz-date

string

hws和amazon请求的当前时间,格式如:20161026T005932Z。

20220126T065102Z

true

Host

string

三方厂商Host。

hicinema-mmpmedia-test-cn.obs.cn-north-1.myhuaweicloud.com

true

Content-Type

string

NSP不传x-nsp-content-type参数时默认“application/octet-stream”。

image

true

user-agent

string

客户端类型。

Java/1.8.0_272

true

响应样例

{
  "data": {
    "headers": {
      "Authorization": "AWS4-HMAC-SHA256 Credential=I06FNCS2OGN5YXWTTPZC/20220325/cn-north-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=fc1897310fe1d92eaefa1e58fd1d442d63604aa63763c0faca2d940d0b206f35",
      "x-amz-content-sha256": "3546fb7a0c8df3be7c0f48f1312d61b7955411655ae62d694840a83132f1f779",
      "x-amz-date": "20220325T064109Z",
      "connection": "close",
      "Host": "hicinema-mmpmedia-test-cn.obs.cn-north-1.myhuaweicloud.com",
      "Content-Type": "image/jpeg",
      "user-agent": "Java/1.8.0_322"
    },
    "imageId": "854954091556871040",
    "method": "PUT",
    "url": "https://hicinema-mmpmedia-test-cn.obs.cn-north-1.myhuaweicloud.com/contentsrc/import/CP180162667662193730/mos/part/b85db6a5-7b5a-4ffc-8f95-c74966cb0500.jpg"
  },
  "retCode": 0,
  "retMsg": "success"
}