TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlitripTravelVisaApplicantImportRequest req = new AlitripTravelVisaApplicantImportRequest();
req.setPhotoFile(new FileItem("/tmp/file.txt"));
req.setOuterApplyId("123");
req.setPassportFileType("jpg");
req.setNationId(27027L);
req.setPassportFile(new FileItem("/tmp/file.txt"));
req.setPhotoFileType("jpg");
req.setFormDataJson("{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}");
AlitripTravelVisaApplicantImportResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlitripTravelVisaApplicantImportRequest req = new AlitripTravelVisaApplicantImportRequest();
req.PhotoFile = new FileItem("/tmp/file.txt");
req.OuterApplyId = "123";
req.PassportFileType = "jpg";
req.NationId = 27027L;
req.PassportFile = new FileItem("/tmp/file.txt");
req.PhotoFileType = "jpg";
req.FormDataJson = "{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}";
AlitripTravelVisaApplicantImportResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlitripTravelVisaApplicantImportRequest;
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setPhotoFile(@fileLocation);
$req->setOuterApplyId("123");
$req->setPassportFileType("jpg");
$req->setNationId("27027");
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setPassportFile(@fileLocation);
$req->setPhotoFileType("jpg");
$req->setFormDataJson("{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}");
$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=alitrip.travel.visa.applicant.import' \
-F 'partner_id=apidoc' \
-F 'session=95e3c83a-880a-46b0-a8c3-7b8843c81d7f' \
-F 'sign=F902D36B8D255020A8E30FA615C90017' \
-F 'sign_method=hmac' \
-F 'timestamp=2025-01-07+06%3A19%3A38' \
-F 'v=2.0' \
-F 'form_data_json=%7B%5C%22lastNamePinyin%5C%22%3A%5C%22%E6%8B%BC%E9%9F%B3%E5%A7%93%5C%22%2C%5C%22firstNamePinyin%5C%22%3A%5C%22%E6%8B%BC%E9%9F%B3%E5%90%8D%5C%22%2C%5C%22nameCh%5C%22%3A%5C%22%E4%B8%AD%E6%96%87%E5%90%8D%5C%22%2C%5C%22passportNumber%5C%22%3A%5C%22G12345678%5C%22%2C%5C%22sex%5C%22%3A%5C%22M%5C%22%2C%5C%22nationality%5C%22%3A%5C%22CHN%5C%22%2C%5C%22birthday%5C%22%3A%5C%221900-01-01%5C%22%2C%5C%22enterDate%5C%22%3A%5C%222019-07-01%5C%22%2C%5C%22daibanTypeId%5C%22%3A%5C%221%5C%22%2C%5C%22domesticPhoneNum%5C%22%3A%5C%2215911111111%5C%22%2C%5C%22applicantEmail%5C%22%3A%5C%2212%40qq.com%5C%22%7D' \
-F 'nation_id=27027' \
-F 'outer_apply_id=123' \
-F 'passport_file_type=jpg' \
-F 'photo_file_type=jpg' \
-F 'photo_file=@/tmp/file.txt' \
-F 'passport_file=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlitripTravelVisaApplicantImportRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.photo_file=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
req.outer_apply_id="123"
req.passport_file_type="jpg"
req.nation_id=27027
req.passport_file=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
req.photo_file_type="jpg"
req.form_data_json="{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}"
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,"alitrip.travel.visa.applicant.import");
add_file_param(pRequest,"photo_file","文件内容");
add_param(pRequest,"outer_apply_id","123");
add_param(pRequest,"passport_file_type","jpg");
add_param(pRequest,"nation_id","27027");
add_file_param(pRequest,"passport_file","文件内容");
add_param(pRequest,"photo_file_type","jpg");
add_param(pRequest,"form_data_json","{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}");
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('alitrip.travel.visa.applicant.import', {
'photo_file':'文件内容',
'outer_apply_id':'123',
'passport_file_type':'jpg',
'nation_id':'27027',
'passport_file':'文件内容',
'photo_file_type':'jpg',
'form_data_json':'{\"lastNamePinyin\":\"拼音姓\",\"firstNamePinyin\":\"拼音名\",\"nameCh\":\"中文名\",\"passportNumber\":\"G12345678\",\"sex\":\"M\",\"nationality\":\"CHN\",\"birthday\":\"1900-01-01\",\"enterDate\":\"2019-07-01\",\"daibanTypeId\":\"1\",\"domesticPhoneNum\":\"15911111111\",\"applicantEmail\":\"12@qq.com\"}'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})