TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlitripTravelNormalvisaUploadfileRequest req = new AlitripTravelNormalvisaUploadfileRequest();
req.setFileBytes(new FileItem("/tmp/file.txt"));
req.setFileName("a.pdf");
req.setBizOrderId(1111L);
AlitripTravelNormalvisaUploadfileResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlitripTravelNormalvisaUploadfileRequest req = new AlitripTravelNormalvisaUploadfileRequest();
req.FileBytes = new FileItem("/tmp/file.txt");
req.FileName = "a.pdf";
req.BizOrderId = 1111L;
AlitripTravelNormalvisaUploadfileResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlitripTravelNormalvisaUploadfileRequest;
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setFileBytes(@fileLocation);
$req->setFileName("a.pdf");
$req->setBizOrderId("1111");
$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.travel.normalvisa.uploadfile' \
-F 'partner_id=apidoc' \
-F 'session=aab908ce-1f63-49dc-b5c4-3e4e1a146443' \
-F 'sign=75C2ECA438B164B150E93F029F479A37' \
-F 'sign_method=hmac' \
-F 'timestamp=2025-01-07+06%3A30%3A37' \
-F 'v=2.0' \
-F 'biz_order_id=1111' \
-F 'file_name=a.pdf' \
-F 'file_bytes=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlitripTravelNormalvisaUploadfileRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.file_bytes=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
req.file_name="a.pdf"
req.biz_order_id=1111
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.travel.normalvisa.uploadfile");
add_file_param(pRequest,"file_bytes","文件内容");
add_param(pRequest,"file_name","a.pdf");
add_param(pRequest,"biz_order_id","1111");
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.travel.normalvisa.uploadfile', {
'file_bytes':'文件内容',
'file_name':'a.pdf',
'biz_order_id':'1111'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})