接口地址:https://www.mxnzp.com/api/barcode/goods/details |
---|
返回格式:json |
请求方式:get |
请求示例:https://www.mxnzp.com/api/barcode/goods/details?barcode=6902538005141&app_id=&app_secret= |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
app_id | string | 必填 | app_id 扫码关注公众号 |
app_secret | string | 必填 | app_secret 扫码关注公众号 |
barcode | string | 必填 | 扫面条形码后的商品数字 |
名称 | 类型 | 说明 |
---|---|---|
goodsName | string | 商品名称 |
barcode | string | 商品对应的条形码code |
price | string | 预估价格 |
brand | string | 品牌 |
supplier | string | 厂商 |
standard | string | 规格 |
{
"code": 1,
"msg": "数据返回成功!",
"data": {
"goodsName": "清风原木纯品金装系列中规格抽取式面巾纸",
"barcode": "6922266446146",
"price": "5.20",
"brand": "清风",
"supplier": "金红叶纸业集团有限公司",
"standard": "单包"
}
}
错误码 | 说明 |
---|---|
0 | app_id或者app_secret不合法 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2022/08/04 14:56
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://www.mxnzp.com/api/barcode/goods/details?barcode=6902538005141&app_id=&app_secret=';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://www.mxnzp.com/api/barcode/goods/details?barcode=6902538005141&app_id=&app_secret="
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}