商品抠图
描述
本接口用于图片内商品抠图
接口鉴权
接口地址
【POST】https://open-api.gaoding.com/api/call/mattingproduct
请求头(request header)
需要加上User-Agent 头,没有User-Agent 头会标记异常请求。案例参考:User-Agent 头 加上"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
字段  | 类型  | 是否必填  | 字段描述  | 
app_id  | string  | 是  | 应用ID,获取方式:应用列表 -> 应用详情 -> APP ID  | 
请求体(request body)
字段  | 类型  | 是否必填  | 字段描述  | 
url  | string  | 二个必填一个 优先级:url>file_base64  | 原图url,支持JPG、PNG格式, 仅保留1个月,请及时转储 (无文件大小限制)  | 
file_base64  | string  | 原图的base64码 (最大支持3M文件)  | |
result_type  | string  | 否  | 结果返回类型: 枚举值:url,base64 默认url  | 
use_compress  | number  | 否  | 是否压缩:0-否,1-是,默认为0  | 
请求体示例(url):
<code>{
    "url": "https://matting-batch.dancf.com/cloths/20220825_163836_gaoding_imagematting_commodity.jpg"
}</code>请求体示例(base64):
<code>{
	  "file_base64":"图片的base64编码"
}</code>响应体(response body)
字段  | 类型  | 是否必存在  | 字段描述  | 
result  | string  | 是  | url入参:结果图url,返回PNG格式,仅保留1个月,请及时转储。 base64入参:返回图片base编码  | 
响应示例1(模拟正常请求:url入参):
http_status:200
response body:
<code>{
	"result": "https://matting-batch.dancf.com/dev/api/313fb08ae0ff3c9e-20220825163915653.png"
}</code>响应示例2(模拟正常请求:base64入参):
http_status:200
response body:
<code>{
	"result": "图片的base64编码"
}</code>响应示例3(模拟参数非法请求):
http_status:400
response body:
<code>{
    "code": -10003,
    "message": "InvalidArgsError"
}</code>错误码
HTTP状态码  | 业务错误码  | 含义  | 
400  | -10003  | 参数非法  | 
400  | -10024  | 通过指定的upload_address 上传的的时候失败  | 
400  | -10001  | 下载失败,可能是用户传的url非法,或者网络异常等原因导致下载失败  | 
400  | -10002  | 解码图片失败,可能是某些格式比较特殊的图片暂时还不支持,或者图片url下载下来根本不是图像数据  | 
400  | -10007  | 图片数据过大,无法处理  | 
500  | 服务器错误  | |
422  | 接口入参错误  |