上传条形码图片的base64编码,返回识别到的条形码数字。
上传条形码图片的base64编码,返回识别到的条形码数字。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| image_data | string | 是 | 图片base64编码字符串 |
[
{
"name": "image_data",
"type": "string",
"required": true,
"description": "图片base64编码字符串",
"example": ""
}
]{"openapi":"3.1.1","info":{"title":"条形码识别","description":"上传条形码图片的base64编码,返回识别到的条形码数字。","version":"1.0.0"},"paths":{"/apis/gateway?api=barcode":{"get":{"summary":"条形码识别","description":"上传条形码图片的base64编码,返回识别到的条形码数字。","parameters":[{"name":"image_data","in":"query","required":true,"schema":{"type":"string"},"description":"图片base64编码字符串"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"条形码识别","description":"上传条形码图片的base64编码,返回识别到的条形码数字。","parameters":[{"name":"image_data","in":"query","required":true,"schema":{"type":"string"},"description":"图片base64编码字符串"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"servers":[{"url":"https://api.souxiaocha.com","description":"当前访问入口(https)"}]}
{"success":false,"error":"missing_image","message":"请提供图片base64数据"}https://api.souxiaocha.com/apis/gateway?api=barcodeGET https://api.souxiaocha.com/apis/gateway?api=barcode apikey=你的API密钥&image_data=请填写image_data
GET 参数放在查询字符串中。参数值请替换为实际有效值。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
image_data | string | 是 | 图片base64编码字符串 |
{"success":false,"error":"missing_image","message":"请提供图片base64数据"}上传条形码图片的base64编码,返回识别到的条形码数字。
https://api.souxiaocha.com/apis/gateway?api=barcode
GET / POST(业务参数 GET 通过 URL 传递,POST 支持表单或 JSON)
调用需携带平台密钥(用户中心「令牌管理」获取,SK- 开头):
key=SK-你的密钥X-API-Key: SK-你的密钥| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| image_data | string | 是 | 图片base64编码字符串 |
[
{"name": "image_data", "type": "string", "required": true, "description": "图片base64编码字符串"}
]
失败返回示例:
{"success":false,"error":"missing_image","message":"请提供图片base64数据"}
| 参数名 | 类型 | 说明 |
|---|---|---|
| data.barcode | string | 识别到的条形码数字 |
curl "https://api.souxiaocha.com/apis/gateway?api=barcode?key=SK-你的密钥&image_data=iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk%2BM9QDwADhgGAWjR9awAAAABJRU5ErkJggg%3D%3D"
上游业务级错误:
| code | msg | 描述 |
|---|---|---|
| 400 | missing_image | 缺少图片数据 |
| 400 | image_too_large | 图片超过3M |
| 405 | method_not_allowed | 仅支持POST |
| 500 | api_request_failed | 请求异常 |
| 502 | query_failed | 识别失败 |
平台级错误(errcode):11001 缺少密钥 / 11002 密钥无效或已禁用 / 11005 接口禁用 / 11006 接口维护 / 11010 积分不足 / 11018 请求方式不允许。
失败时请以响应体中的 code / errcode 与 msg 判断。
2026-09-24
curl "https://api.souxiaocha.com/apis/gateway?api=barcode?key=SK-你的密钥&image_data=iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk%2BM9QDwADhgGAWjR9awAAAABJRU5ErkJggg%3D%3D"
// 结果将在此处显示