开放数据API接口说明

本着合作共赢、资源共享的原则,天天芯片所有注册用户可通过API免费获取商城自营库存数据。

概述

本文档定义了天天芯片系统对外提供的API服务接口的通信协议、接口规范及接口内容,供客户自有系统对接使用。

协议规范

传输协议

API采用HTTPS协议传输,报文内容使用JSON格式,字符编码为UTF-8,签名算法暂只支持MD5。

项目 说明
通信协议 HTTP
服务地址 https://www.365chips.com/bapi
报文格式 JSON
字符编码 UTF-8
签名算法 暂只支持MD5

公共请求参数

参数 参数名称 类型 必填 描述 示例
version API版本 string 必填 用于API版本管理,升级过度,当前最新版本为1.0 1.0
app_id 应用ID string 必填 每个接入的客户都对应一个app_id,用于区分接入身份,客户登录 订单管理系统后可获取。 nchp_8
time_stamp 报文时间戳 string 必填 通过API访问服务器的时间戳,用于判断报文时效以及验签安全。 1714284736
sign_type 验签方式 string 必填 标记报文签名和验签的算法,目前只支持MD5 MD5
sign 签名 string 必填 根据签名算法计算出来的报文签名,验证数据的完整性,防止篡改。 83a647cbe3c29c7229e4074f7d9c800d

公共返回参数

参数 参数名称 类型 必填 描述 示例
code 错误码 int 必填 标记是否正确返回,以及错误类型 1303
msg 错误信息 string 必填 对错误码code的解释说明 验签失败

错误码列表

错误代码 解释说明
200 success
1301 缺少参数
1302 参数不合法
1303 验签失败

验签以及密钥获取

所有对接本系统的系统,需要注意目前第三方系统对接时采用MD5方式计算签名.
签名步骤如下:

  • 需要参与签名的参数:
    参与签名的参数不能包含sign、sign_type两个参数,另外增加密钥参数secret;
  • 对参与签名的参数进行排序;
  • 打包字符串:
    按照排序后的顺序,对每个参数的键值对用=拼接,然后用&拼接,例如:
    abstract=Connector Header Through Hole 10 position 0.100 (2.54mm)&app_id=nchp_8&brandName=3M&categoryName=其他连接器&imgs=[]&name=2310-6121-TG&num=3&pagerTool=requests&prices=[{"n": 1, "p": d2.7511}]&secret=fc7a29d636606966d13bcdfa8177ad6a&startNum=1&stock=东莞大朗仓&time_stamp=1714289094&url=https://www.test.com/ProductDetail?goodsId=24721&version=1.0&warehouse=东莞大朗仓
  • 对字符串进行UTF-8编码;
  • UTF-8字节流做MD5计算,获取MD5值(32位),例如:
    5c66d095ad38ba474fc918be29cf0155
    赋值参数sign;
  • 删除参数secret,增加参数sign_type。

客户接口

自营库存查询

服务器地址

https://www.365chips.com/bapi/opendata/getSelfStock

请求参数

参数 参数名称 类型 必填 描述 示例
version API版本 string 必填 用于API版本管理,升级过度,当前最新版本为1.0 1.0
app_id 应用ID string 必填 每个接入的客户都对应一个app_id,用于区分接入身份,客户登录 订单管理系统后可获取。 nchp_8
time_stamp 报文时间戳 string 必填 通过API访问服务器的时间戳,用于判断报文时效以及验签安全。 1714284736
sign_type 验签方式 string 必填 标记报文签名和验签的算法,目前只支持MD5 MD5
sign 签名 string 必填 根据签名算法计算出来的报文签名,验证数据的完整性,防止篡改。 83a647cbe3c29c7229e4074f7d9c800d
searchKey 型号关键字 string 必填 至少三个字符,少于三个返回空的结果。 RL30-600

返回参数

参数 参数名称 类型 必填 描述 示例
code 错误码 int 必填 标记是否正确返回,以及错误类型 200
msg 错误信息 string 必填 对错误码code的解释说明 success
data 查询结果 json 必填 包含"list", "total"两个子字段,list为数组,total为整型 {"code":200,"msg":"success","data":{"list":[{"id":1,"name":"LTM4644IY","brandName":"LINEAR","categoryName":"DC/DC变换器","abstract":"具有可配置4A输出阵列的四通道DC/DCμModule(电源模块)稳压器","warehouse":"上海","num":1022,"packnum":1,"startnum":1,"updated_at":"2024-06-28 16:55:35","prices":[{"n":1,"p":2},{"n":10,"p":1.8},{"n":100,"p":1.5},{"n":1000,"p":1.2},{"n":10000,"p":1}],"params":[{"k":"输入电压最小值","v":"4V"},{"k":"输入电压最大值","v":"14V"},{"k":"输出个数","v":"4"},{"k":"直流直流转换器芯片封装","v":"BGA"},{"k":"针脚数","v":"77Pins"},{"k":"输出电流","v":"4A"},{"k":"输出电压最小值","v":"600mV"},{"k":"输出电压最大值","v":"5.5V"},{"k":"开关频率","v":"1MHz"},{"k":"拓扑结构","v":"降压"},{"k":"工作温度最高值","v":"125°C"},{"k":"产品范围","v":"TUK SGACK902S Keystone Coupler"},{"k":"MSL","v":"MSL 3-168小时"}],"images":["/media/prodimgs/1_171956058492219_165.jpg"],"datasheets":["/media/datasheets/1_171956059619688_251.pdf"]}],"total":1}}

订单详细查询

服务器地址

https://www.365chips.com/bapi/opendata/getOrderDetail

请求参数

参数 参数名称 类型 必填 描述 示例
version API版本 string 必填 用于API版本管理,升级过度,当前最新版本为1.0 1.0
app_id 应用ID string 必填 每个接入的客户都对应一个app_id,用于区分接入身份,客户登录 订单管理系统后可获取。 nchp_8
time_stamp 报文时间戳 string 必填 通过API访问服务器的时间戳,用于判断报文时效以及验签安全。 1714284736
sign_type 验签方式 string 必填 标记报文签名和验签的算法,目前只支持MD5 MD5
sign 签名 string 必填 根据签名算法计算出来的报文签名,验证数据的完整性,防止篡改。 83a647cbe3c29c7229e4074f7d9c800d
orderNum 订单号 string 必填 O20240417652230

返回参数

参数 参数名称 类型 必填 描述 示例
code 错误码 int 必填 标记是否正确返回,以及错误类型 200
msg 错误信息 string 必填 对错误码code的解释说明 success
data 查询结果 json 必填 查询不到订单,返回{} {"code":200,"msg":"success","data":{"id":2176,"buyUser_id":20,"orderNum":"O2103052047","deliveryFee":"0.00","discount":"0.00","firstPay":"0.84","payMethod":"alipay","invoiceInfo":{},"addressInfo":{"id":191,"detail":"sdfsafdsafdsafsadf","receiver":"张瑞雪","province":"110000","provinceName":"北京市","city":"110100","cityName":"市辖区","county":"110105","countyName":"朝阳区","phone":"18918371222","updated_at":"2017-11-04 10:42:57","created_at":"2017-11-04 10:42:57"},"reserved":"","mark":null,"status":20,"statusName":"订单完结","payStatus":20,"payStatusName":"支付完毕","deliveryStatus":20,"deliveryStatusName":"已收货","invoiceStatus":30,"invoiceStatusName":"无需开票","updated_at":"2022-09-05 02:28:35","created_at":"2021-03-05 15:00:09","expired":false,"carts":[{"id":5545,"order_id":2176,"product_id":24770813,"stock_id":0,"productName":"LQW2UASR62J00L","brandName":"MURATA ELECTRONICS NORTH AMERICA","suplyName":"Arrow Electronics","finalSuplyName":"","prices":[{"n":1,"p":"0.8404"}],"stockNum":1,"startNum":1,"packNum":1,"price":"0.8404","finalPrice":"0.8404","tariff":"0.0000","checkFee":"0.0000","buyNum":1,"finalBuyNum":1,"status":30,"type":0,"amount":"0.84","statusName":"已完结","updated_at":"2021-03-12 18:59:20","created_at":"2021-03-05 15:00:02","sentNum":1,"recvedNum":1,"invoicedNum":0,"storageNum":0,"purchasingNum":0}],"amount":"0.84","discountInfo":null,"payFlows":[{"id":1684,"order_id":2176,"direction":0,"directionName":"付款","payOrderNum":"O2103052047","method":0,"methodName":"支付宝","dueAmount":"0.84","amount":"0.84","reserved":"{\"discount\":\"0.00\",\"payment_type\":\"1\",\"trade_no\":\"2021030522001455721452699329\",\"subject\":\"LQW2UASR62J00L\",\"buyer_email\":\"zha***@sina.com\",\"gmt_create\":\"2021-03-05 15:00:22\",\"notify_type\":\"trade_status_sync\",\"quantity\":\"1\",\"out_trade_no\":\"O2103052047\",\"notify_time\":\"2021-03-05 15:00:27\",\"body\":\"LQW2UASR62J00LX1\",\"trade_status\":\"TRADE_SUCCESS\",\"is_total_fee_adjust\":\"N\",\"total_fee\":\"0.84\",\"gmt_payment\":\"2021-03-05 15:00:26\",\"price\":\"0.84\",\"buyer_id\":\"2088902932355727\",\"notify_id\":\"2021030500222150027055721411310709\",\"use_coupon\":\"N\",\"sign_type\":\"MD5\",\"sign\":\"0618c0d86e902b38edc20da99d62f4de\"}","status":10,"statusName":"已支付","updated_at":"2021-03-05 15:00:31","created_at":"2021-03-05 15:00:31"}],"pointFlows":[],"bankPayingAmount":"0.00","payingAmount":"0.00","amountPayed":"0.84","pointPayed":"0.00","dueInvoiceAmount":"0","amountDuePay":"0.00","deliveryInfos":[{"id":1326,"company":"jd","companyName":"京东","number":"23514123421321","deliveryFee":"0.00","status":10,"statusName":"已收货","created_at":"2021-03-05 17:30:55","flows":[{"num":1,"id":3383,"productName":"LQW2UASR62J00L","brandName":"MURATA ELECTRONICS NORTH AMERICA","finalBuyNum":1}],"url":"http://www.kuaidi100.com/chaxun?com=jd&nu=23514123421321"}],"invoicedAmount":"0","invoiceFlows":[],"existsToPurchase":false,"existsToArrive":false,"existsTosend":false,"existsSent":true,"existsToRecv":false,"existsInvoiced":false,"existstoInvoice":true,"existsInvoiceTosend":false,"activities":[{"content":"创建订单","timestamp":"2021-03-05 15:00:09","icon":"map-pin-add-line","cardType":"warning"},{"content":"确认订单信息","timestamp":"2021-03-05 15:00:31","icon":"git-pull-request-line","cardType":"warning"},{"content":"通过支付宝方式支付了0.84","timestamp":"2021-03-05 15:00:31","icon":"alipay-line","cardType":"warning"}]}}