条码查询 商品条码查询

  • 与 多个权威数据源 同步

数据来源 source

顺序数据源说明
1cn中国物品编码
2upc美国商品统一代码
3isbn国际标准书号
4other其他

系统按照以上顺序调用数据源,首选中国物品编码。
当中国物品编码无相关条码数据时,自动调用其他权威数据源。

条码类型 type

EAN-1313位标准码
UPCUPC条码
ISBNISBN书号
EAN-88位缩短码

自动识别条码类型

请求参数

参数位置必填
keyheaderkey
barcodeurl商品条码(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
;

接口错误码所有接口错误码一致

400Bad Request请求参数错误
404Not Found无效或不存在
502Bad Gateway不支持或查询失败
503Service Unavailable繁忙或者临时维护,请稍后重试
410Gone接口已失效/下线

code = 错误码 (int),message = 错误信息 (string)
查询成功:code===0
每次请求均会返回 cost(扣费) 和 balance(余额),方便随时记录和监控
错误(400)和无效(404)扣费 0.02 元,其他错误不扣费

用户错误码

401Unauthorized密钥无效
402Payment Required余额不足
403Forbidden无权限(IP白名单限制)

接口具体错误信息见 message
如果前端需要返回错误信息,请直接返回 message 的内容