TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaNrsItemPricetagRecognizeRequest req = new AlibabaNrsItemPricetagRecognizeRequest();
AlibabaNrsItemPricetagRecognizeRequest.PriceTagReqParam obj1 = new AlibabaNrsItemPricetagRecognizeRequest.PriceTagReqParam();
obj1.setObjKeyName("123.jpg");
obj1.setBusiCode("RT");
obj1.setSource("RT");
obj1.setBarCode("698232323");
obj1.setExtendInfoMap("{}");
req.setPriceTagParam(obj1);
req.setImgByteArr(new FileItem("/tmp/file.txt"));
AlibabaNrsItemPricetagRecognizeResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlibabaNrsItemPricetagRecognizeRequest req = new AlibabaNrsItemPricetagRecognizeRequest();
AlibabaNrsItemPricetagRecognizeRequest.PriceTagReqParamDomain obj1 = new AlibabaNrsItemPricetagRecognizeRequest.PriceTagReqParamDomain();
obj1.ObjKeyName = "123.jpg";
obj1.BusiCode = "RT";
obj1.Source = "RT";
obj1.BarCode = "698232323";
obj1.ExtendInfoMap = "{}";
req.PriceTagParam_ = obj1;
req.ImgByteArr = new FileItem("/tmp/file.txt");
AlibabaNrsItemPricetagRecognizeResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlibabaNrsItemPricetagRecognizeRequest;
$price_tag_param = new PriceTagReqParam;
$price_tag_param->obj_key_name="123.jpg";
$price_tag_param->busi_code="RT";
$price_tag_param->source="RT";
$price_tag_param->bar_code="698232323";
$price_tag_param->extend_info_map="{}";
$req->setPriceTagParam(json_encode($price_tag_param));
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setImgByteArr(@fileLocation);
$resp = $c->execute($req);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:multipart/form-data;charset=utf-8' \
-F 'app_key=12129701' \
-F 'format=json' \
-F 'method=alibaba.nrs.item.pricetag.recognize' \
-F 'partner_id=apidoc' \
-F 'sign=AE0C1792A96A6A1B6A804CA5352D20C0' \
-F 'sign_method=hmac' \
-F 'timestamp=2025-05-24+20%3A44%3A03' \
-F 'v=2.0' \
-F 'price_tag_param=null' \
-F 'img_byte_arr=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlibabaNrsItemPricetagRecognizeRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.price_tag_param=""
req.img_byte_arr=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
try:
resp= req.getResponse()
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"alibaba.nrs.item.pricetag.recognize");
add_param(pRequest,"price_tag_param","数据结构JSON示例");
add_file_param(pRequest,"img_byte_arr","文件内容");
pResponse = top_execute(pClient,pRequest,NULL);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('alibaba.nrs.item.pricetag.recognize', {
'price_tag_param':'数据结构JSON示例',
'img_byte_arr':'文件内容'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})