# 车辆图片上传

最新更新时间:2023.06.13

车场入场离场时上传车辆照片。

# 接口说明

请求URL: https://{domain}/os-park/ospark/open/api/v2/uploadImage

请求方式: POST

公共请求参数

参数名 必填 类型 说明
access_id string 开发者唯一标识
sign_type string 固定传RSA2
time_stamp long 请求时间,Linux时间戳,单位毫秒
sign string 签名结果
data string 将业务参数转为JSON字符串,然后使用BASE64编码的数据

详细签名方法请阅读接口加密方案

请求参数

名称 必填 类型 说明
osStoreCode string 备案系统中停车场编码(开放平台门店Code)
carPlate string 车牌号
carPlateColor int 车牌颜色 1-蓝色 2-黄色 3-白色 4-黑色 5-绿色 6-黄绿双拼色 常量定义在SDK的TyhConstants.CarPlateColor中
orderId string 订单记录号(车辆在停车场唯一停车订单编号,支持数字 字母 _ -,最大长度32),车场方生成
content string 出场图片数据,内容根据imageType决定
source int 图片来源 1-上传驶入照片 2-上传驶出照片 3-上传车位监控照片 4-上传车道监控抓拍图片 常量定义在SDK的TyhConstants.ImageSource中
imageType int 图片上传类型
1-图片URL链接
2-把图片文件读取为btye[],然后base64编码。图片格式要求为jpg,限制图片大小不得超过300K

SDK方法

// 创建上传数据client
TyhUploadClient client = TyhUploadClient.create(TyhOptions.builder()
    .accessId(ACCESS_ID)
    .secretKey(SECRET_KEY)
    .build());
    
// 图片上传
OpenParkingImageCmd cmd = OpenParkingImageCmd.builder()
    .osStoreCode(OS_STORE_CODE)
    .carPlate("皖Axxxxx")
    .carPlateColor(TyhConstants.CarPlateColor.BLUE)
    .orderId("order123456662")
    .content("https://ossweb.hfcsbc.com/tyh/asset/app-icon.png")
    .source(TyhConstants.ImageSource.DRIVE_IN)
    .imageType(TyhConstants.ImageType.URL)
    .build();
           
// 发送请求 results.ifSuccess()表示请求成功
Results results = client.uploadImage(cmd); 

入参格式

{
  "osStoreCode" : "30000000000001",
  "carPlate": "皖Axxxxx",
  "carPlateColor": 1,
  "orderId": "8181817278000000",
  "content": "https://ossweb.hfcsbc.com/tyh/asset/app-icon.png",
  "source": 2,
  "imageType" : 1
}

出参格式

 { "code":8888, "msg":"success", "data": "json数据"}

code 为 8888 表示操作成功,其它值则为失败,具体内容参见错误码说明。