插入背景
更新时间 2025/02/22 07:19:43
英飞画布服务端支持基于 Restful API 往画布中插入图片作为背景。
前提条件
Http 请求
- 请求路径:
https://api.infi.cn/u3wbs/wbs/websdk/background/insertBgImage
- 请求参数 Query
字段
类型
描述
appId
string
应用 appId,可以在开发者门户中获取
expire
integer
签名过期时间戳(毫秒)
recordId
string
画布 recordId,即创建画布时返回的 recordId
userId
string
创建者 Id
signature
string
签名,生成方式见链接
请求参数示例:
appId=test&expire=12345678901234&recordId=12345678901234&userId=lzl&signature=70D59A285EE91C666020FB3D0359FBAAA1867145
请求的参数连同请求签名需要以 Url Search Params 形式拼接至接口路径之后。
- 请求参数 Body
字段
类型
描述
是否必填
position
object
预置元素的坐标
是
position.x
integer
元素左上角 x 坐标
是
position.y
integer
元素左上角 y 坐标
是
size
object
放置大小
是
size.width
integer
文档宽度
是
size.height
integer
文档高度
是
imgType
integer
1:JPG 2:JPEG 3:PNG 4:GIF
是
picUrl
string
图片的 Url 地址
是
alpha
integer
图片透明度
是
请求参数示例:
{
"imgType": "png",
"picUrl": "// 请填写图片的Url地址",
"position": {
"x": 1234.1234,
"y": 1234.1234
},
"size": {
"width": 1280,
"height": 720
},
"alpha": 0
}
- 请求返回体
字段
类型
描述
code
integer
0 表示成功,其他表示失败
reqId
string
请求 id
reqTime
integer
请求时间戳
obj
object
解析结果
obj.elementId
string
元素 ID
返回体示例:
{
"code": 0,
"reqId": "12345678901234",
"reqTime": 12345678901234,
"obj": {
"elementId": "aaaabbbbccccdddd"
}
}
- 请求失败情况 响应包体中 code 字段不为 0 时表请求失败,失败信息请查询错误码列表。