条码查询 商品条码查询
- 与 多个权威数据源 同步
- 接口:http://api.3023data.com/item/barcode?barcode=6937913311241 / barcode=889652114873
- 方式:GET
- 支持:EAN-13 / UPC / ISBN / EAN-8
- 价格:0.02元/次 价格优惠,最低至2.5折
- 2.5折时:0.005元/次
数据来源 source
| 顺序 | 数据源 | 说明 |
| 1 | cn | 中国物品编码 |
| 2 | upc | 美国商品统一代码 |
| 3 | isbn | 国际标准书号 |
| 4 | other | 其他 |
系统按照以上顺序调用数据源,首选中国物品编码。
当中国物品编码无相关条码数据时,自动调用其他权威数据源。
条码类型 type
| EAN-13 | 13位标准码 |
| UPC | UPC条码 |
| ISBN | ISBN书号 |
| EAN-8 | 8位缩短码 |
自动识别条码类型
请求参数
| 参数 | 位置 | 必填 | 值 |
| key | header | 是 | key |
| barcode | url | 是 | 商品条码(8-14位数字) 8/12/13/14位 |
key in request header or url
13位标准码 EAN-13
{
"code": 0,
"data": {
"barcode": "6937913311241", //条码
"type": "EAN-13", //类型
"name": "碧生源润肠胶囊", //商品名称
"spec": "24粒", //规格
"size": "高度:85毫米 宽度:140毫米 深度:35毫米 毛重:35克 净含量:9.6克", //尺寸/重量
"description": "", //说明
"price": "", //价格
"brand": "碧生源", //品牌
"gpc": "药品", //商品分类
"gpccode": "10005845", //GPC分类代码
"country": "中国", //国家、地区或应用领域
"company": "吉林省银诺克药业有限公司", //公司(发布企业)
"addr": "", //公司地址
"importer": "", //进口商
"launch": "2018-10-10", //上市时间
"image": "https://oss.gds.org.cn/userfile/20201010/672731255.png", //商品图片
"prefix": "69379133", //厂商识别代码
"gtin": "http://bc.3023data.com/barcode/gensvg?type=ean13&msg=6937913311241&fmt=png", //条码图片
"source": "cn" //数据来源
},
"source": "m-a",
"cost": 0.02,
"balance": 3023
}
UPC条码 UPC
{
"code": 0,
"data": {
"barcode": "889652114873",
"type": "UPC",
"name": "Saint Laurent SL 205/K 002 Havana Square Sunglasses",
"spec": "57/17/145",
"size": "",
"description": "SL 205/K",
"price": "184.01 USD",
"brand": "SAINT LAURENT",
"gpc": "Clothing, Shoes & Jewelry",
"gpccode": "",
"country": "",
"company": "Saint Laurent",
"addr": "",
"importer": "",
"launch": "",
"image": "https://images-na.ssl-images-amazon.com/images/I/31L9hy7vIjL.jpg",
"prefix": "",
"gtin": "http://bc.3023data.com/barcode/gensvg?type=upca&msg=889652114873&fmt=png",
"source": "upc"
},
"source": "m-a",
"cost": 0.02,
"balance": 3023
}
ISBN书号 ISBN
{
"code": 0,
"data": {
"barcode": "9787020002207",
"type": "ISBN",
"name": "红楼梦", //标题
"spec": "1606页", //页数
"size": "",
"description": "平装", //装帧
"price": "59.70元", //定价
"brand": "[清] 曹雪芹 著", //作者
"gpc": "书本、印刷品和参考资料", //产品分类
"gpccode": "10000926", //GPC分类代码
"country": "图书", //应用领域
"company": "人民文学出版社", //出版社
"addr": "",
"importer": "",
"launch": "1996-12", //出版日期
"image": "https://img1.doubanio.com/view/subject/m/public/s1070959.jpg", //封面图片
"prefix": "97870200",
"gtin": "http://bc.3023data.com/barcode/gensvg?type=ean13&msg=9787020002207&fmt=png",
"source": "isbn"
},
"source": "m-a",
"cost": 0.02,
"balance": 3023
}
8位缩短码 EAN-8
{
"code": 0,
"data": {
"barcode": "69021220",
"type": "EAN-8",
"name": "绿箭口香糖",
"spec": "3g×15片",
"size": "",
"description": "复合纸", //包装
"price": "",
"brand": "绿箭",
"gpc": "",
"gpccode": "",
"country": "中国",
"company": "玛氏箭牌糖果(中国)有限公司",
"addr": "",
"importer": "",
"launch": "",
"image": "",
"prefix": "69021220",
"gtin": "http://bc.3023data.com/barcode/gensvg?type=ean8&msg=69021220&fmt=png",
"source": "cn"
},
"source": "m-a",
"cost": 0.02,
"balance": 3023
}
进口商品
{
"code": 0,
"data": {
"barcode": "9555655005265",
"type": "EAN-13",
"name": "麦可利槟城香辣虾汤面",
"spec": "420克",
"size": "",
"description": "",
"price": "",
"brand": "麦可利",
"gpc": "食品/饮料/香烟组合装",
"gpccode": "",
"country": "马来西亚",
"company": "杭州裕联贸易有限公司",
"addr": "",
"importer": "上海擎鹏商贸有限公司", //进口商
"launch": "",
"image": "https://oss.gds.org.cn/userfile/importcpfile/202009091158156459679039074.jpg",
"prefix": "95556550",
"gtin": "http://bc.3023data.com/barcode/gensvg?type=ean13&msg=9555655005265&fmt=png",
"source": "cn"
},
"source": "m-a",
"cost": 0.02,
"balance": 3023
}
条码数据库 MySQL
CREATE TABLE `barcode` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `barcode` char(13) NOT NULL, `name` varchar(512) NOT NULL, `spec` varchar(512) DEFAULT NULL, `size` varchar(512) DEFAULT NULL, `brand` varchar(512) DEFAULT NULL, `company` varchar(512) DEFAULT NULL, `gpc` varchar(512) DEFAULT NULL, `gpccode` varchar(32) DEFAULT NULL, `description` varchar(8192) DEFAULT NULL, `price` varchar(512) DEFAULT NULL, `addr` varchar(512) DEFAULT NULL, `importer` varchar(512) DEFAULT NULL, `launch` varchar(512) DEFAULT NULL, `image` varchar(512) DEFAULT NULL, `source` varchar(32) DEFAULT NULL, `time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `barcode` (`barcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ;
接口错误码所有接口错误码一致
| 400 | Bad Request | 请求参数错误 |
| 404 | Not Found | 无效或不存在 |
| 502 | Bad Gateway | 不支持或查询失败 |
| 503 | Service Unavailable | 繁忙或者临时维护,请稍后重试 |
| 410 | Gone | 接口已失效/下线 |
code = 错误码 (int),message = 错误信息 (string)
查询成功:code===0
每次请求均会返回 cost(扣费) 和 balance(余额),方便随时记录和监控
错误(400)和无效(404)一般扣费 0.05 元,其他错误不扣费
用户错误码
| 401 | Unauthorized | 密钥无效 |
| 402 | Payment Required | 余额不足 |
| 403 | Forbidden | 无权限(IP白名单限制) |
接口具体错误信息见 message
如果前端需要返回错误信息,请直接返回 message 的内容