TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlitripRefundticketUploadvoucherRequest req = new AlitripRefundticketUploadvoucherRequest();
req.setChannelName("feiye");
req.setOrderId(974032987432L);
req.setPassword("7b1e6dd7e98f6e84f246cb4783880449");
req.setFileContent(new FileItem("/tmp/file.txt"));
AlitripRefundticketUploadvoucherResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlitripRefundticketUploadvoucherRequest req = new AlitripRefundticketUploadvoucherRequest();
req.ChannelName = "feiye";
req.OrderId = 974032987432L;
req.Password = "7b1e6dd7e98f6e84f246cb4783880449";
req.FileContent = new FileItem("/tmp/file.txt");
AlitripRefundticketUploadvoucherResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlitripRefundticketUploadvoucherRequest;
$req->setChannelName("feiye");
$req->setOrderId("974032987432");
$req->setPassword("7b1e6dd7e98f6e84f246cb4783880449");
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setFileContent(@fileLocation);
$resp = $c->execute($req, $sessionKey);
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.alitrip.refundticket.uploadvoucher' \
-F 'partner_id=apidoc' \
-F 'session=5e4cfc4f-572d-4a2b-bcbe-3494d986d9f3' \
-F 'sign=6173A53B210A127E460B8584A1D6B21C' \
-F 'sign_method=hmac' \
-F 'timestamp=2025-01-30+12%3A52%3A02' \
-F 'v=2.0' \
-F 'channel_name=feiye' \
-F 'order_id=974032987432' \
-F 'password=7b1e6dd7e98f6e84f246cb4783880449' \
-F 'file_content=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlitripRefundticketUploadvoucherRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.channel_name="feiye"
req.order_id=974032987432
req.password="7b1e6dd7e98f6e84f246cb4783880449"
req.file_content=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
try:
resp= req.getResponse(sessionkey)
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.alitrip.refundticket.uploadvoucher");
add_param(pRequest,"channel_name","feiye");
add_param(pRequest,"order_id","974032987432");
add_param(pRequest,"password","7b1e6dd7e98f6e84f246cb4783880449");
add_file_param(pRequest,"file_content","文件内容");
pResponse = top_execute(pClient,pRequest,sessionKey);
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.alitrip.refundticket.uploadvoucher', {
'channel_name':'feiye',
'order_id':'974032987432',
'password':'7b1e6dd7e98f6e84f246cb4783880449',
'file_content':'文件内容'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})