TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AuctionGovPublishUploadPicRequest req = new AuctionGovPublishUploadPicRequest();
req.setFileName("标的物展示图片1.jpg");
req.setData(new FileItem("/tmp/file.txt"));
AuctionGovPublishUploadPicResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AuctionGovPublishUploadPicRequest req = new AuctionGovPublishUploadPicRequest();
req.FileName = "标的物展示图片1.jpg";
req.Data = new FileItem("/tmp/file.txt");
AuctionGovPublishUploadPicResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AuctionGovPublishUploadPicRequest;
$req->setFileName("标的物展示图片1.jpg");
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setData(@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=taobao.auction.gov.publish.upload.pic' \
-F 'partner_id=apidoc' \
-F 'sign=5DB6B2981C31EBDE62B277B72665F925' \
-F 'sign_method=hmac' \
-F 'timestamp=2025-03-15+03%3A42%3A31' \
-F 'v=2.0' \
-F 'file_name=%E6%A0%87%E7%9A%84%E7%89%A9%E5%B1%95%E7%A4%BA%E5%9B%BE%E7%89%871.jpg' \
-F 'data=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AuctionGovPublishUploadPicRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.file_name="标的物展示图片1.jpg"
req.data=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,"taobao.auction.gov.publish.upload.pic");
add_param(pRequest,"file_name","标的物展示图片1.jpg");
add_file_param(pRequest,"data","文件内容");
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('taobao.auction.gov.publish.upload.pic', {
'file_name':'标的物展示图片1.jpg',
'data':'文件内容'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})