TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaOrderPictureUploadRequest req = new AlibabaOrderPictureUploadRequest();
AlibabaOrderPictureUploadRequest.FileUploadRequest obj1 = new AlibabaOrderPictureUploadRequest.FileUploadRequest();
obj1.setFileName("xxxx.jpg");
req.setParamFileUploadRequest(obj1);
req.setData(new FileItem("/tmp/file.txt"));
AlibabaOrderPictureUploadResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlibabaOrderPictureUploadRequest req = new AlibabaOrderPictureUploadRequest();
AlibabaOrderPictureUploadRequest.FileUploadRequestDomain obj1 = new AlibabaOrderPictureUploadRequest.FileUploadRequestDomain();
obj1.FileName = "xxxx.jpg";
req.ParamFileUploadRequest_ = obj1;
req.Data = new FileItem("/tmp/file.txt");
AlibabaOrderPictureUploadResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlibabaOrderPictureUploadRequest;
$param_file_upload_request = new FileUploadRequest;
$param_file_upload_request->file_name="xxxx.jpg";
$req->setParamFileUploadRequest(json_encode($param_file_upload_request));
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setData(@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=alibaba.order.picture.upload' \
-F 'partner_id=apidoc' \
-F 'session=8b4b5415-06d7-424f-ab1b-c54af51070e8' \
-F 'sign=41328134307E28AEFA7C16012DE1A617' \
-F 'sign_method=hmac' \
-F 'timestamp=2024-11-22+05%3A09%3A34' \
-F 'v=2.0' \
-F 'param_file_upload_request=null' \
-F 'data=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlibabaOrderPictureUploadRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.param_file_upload_request=""
req.data=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,"alibaba.order.picture.upload");
add_param(pRequest,"param_file_upload_request","数据结构JSON示例");
add_file_param(pRequest,"data","文件内容");
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('alibaba.order.picture.upload', {
'param_file_upload_request':'数据结构JSON示例',
'data':'文件内容'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})