TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
CainiaoOrderLogisticsConsignRequest req = new CainiaoOrderLogisticsConsignRequest();
ConsignTopRequestDto obj1 = new ConsignTopRequestDto();
obj1.setConfirmConsign(false);
obj1.setAppName("appkey123");
ConsignTopInfoDto obj2 = new ConsignTopInfoDto();
StoreServiceDto obj3 = new StoreServiceDto();
obj3.setStoreCode("WH001");
obj3.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setStoreServiceDto(obj3);
ConsignContactDto obj4 = new ConsignContactDto();
obj4.setContactId(123456L);
obj4.setMobilePhone("13322224444");
obj4.setDdd("0571");
obj4.setRemark("备注");
obj4.setAddress("浙江省杭州市西湖区文二路398号");
obj4.setWangwangId("XXX店铺");
obj4.setContactName("郭德纲");
obj4.setZipCode("123000");
obj4.setBranch("890");
obj4.setTelephone("88602334");
obj4.setAreaId(330106L);
obj4.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setReceiverContact(obj4);
obj2.setRemark("备注");
AppointServiceDto obj5 = new AppointServiceDto();
obj5.setOsDate("20150518");
obj5.setOsRange("09:00-18:00");
obj5.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setAppointServiceDto(obj5);
ConsignContactDto obj6 = new ConsignContactDto();
obj6.setContactId(123456L);
obj6.setMobilePhone("13322224444");
obj6.setDdd("0571");
obj6.setRemark("备注");
obj6.setAddress("浙江省杭州市西湖区文二路398号");
obj6.setWangwangId("XXX店铺");
obj6.setContactName("郭德纲");
obj6.setZipCode("123000");
obj6.setBranch("890");
obj6.setTelephone("88602334");
obj6.setAreaId(330106L);
obj6.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setSenderContact(obj6);
obj2.setOutTradeNo("123456");
obj2.setConsignType(0L);
InvoinceServiceDto obj7 = new InvoinceServiceDto();
obj7.setBillType(1L);
obj7.setBillTitle("XXX公司");
obj7.setBillAmount(100L);
obj7.setBillContent("发票内容");
obj7.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setInvoinceServiceDto(obj7);
ConsignContactDto obj8 = new ConsignContactDto();
obj8.setContactId(123456L);
obj8.setMobilePhone("13322224444");
obj8.setDdd("0571");
obj8.setRemark("备注");
obj8.setAddress("浙江省杭州市西湖区文二路398号");
obj8.setWangwangId("XXX店铺");
obj8.setContactName("郭德纲");
obj8.setZipCode("123000");
obj8.setBranch("890");
obj8.setTelephone("88602334");
obj8.setAreaId(330106L);
obj8.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setRefundContact(obj8);
List<ConsignGoodsDto> list10 = new ArrayList<ConsignGoodsDto>();
ConsignGoodsDto obj11 = new ConsignGoodsDto();
list10.add(obj11);
obj11.setItemName("衣服");
obj11.setRemark("备注");
obj11.setOutSubTradeNo("123456");
obj11.setProviderId(123456L);
obj11.setQuantity(10L);
obj11.setItemPrice(1000L);
obj11.setItemId("123456");
obj11.setItemCode("A-001");
obj11.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj11.setSkuId(123L);
ConsignPackageDto obj13 = new ConsignPackageDto();
obj13.setPackageWeight("0.1");
obj13.setPackageLength("0.1");
obj13.setPackageHeight("0.1");
obj13.setPackageId(123456L);
obj13.setPackageVolume("0.1");
obj13.setPackageWidth("0.1");
list12.setConsignPackageDto(obj13);
obj11.setIsScItem(false);
obj2.setConsignGoods(list10);
obj2.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
TmsServiceDto obj14 = new TmsServiceDto();
obj14.setMailNo("1106359157302");
obj14.setCpName("中国邮政速递物流");
obj14.setCpCode("EMS");
obj14.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj2.setTmsServiceDto(obj14);
obj2.setSellerId(123456L);
TmsGotServiceDto obj15 = new TmsGotServiceDto();
obj15.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
ConsignContactDto obj16 = new ConsignContactDto();
obj16.setContactId(123456L);
obj16.setMobilePhone("13322224444");
obj16.setDdd("0571");
obj16.setRemark("备注");
obj16.setAddress("浙江省杭州市西湖区文二路398号");
obj16.setWangwangId("XXX店铺");
obj16.setContactName("郭德纲");
obj16.setZipCode("123000");
obj16.setBranch("890");
obj16.setTelephone("88602334");
obj16.setAreaId(330106L);
obj16.setExtendFieldsString("{\"key1\":\"value1\",\"key2\":\"value2\"}");
obj15.setGotAddress(obj16);
obj15.setGotDate("20150501");
obj15.setGotRange("09:00-10:00");
obj2.setTmsGotServiceDto(obj15);
obj2.setLogisticsSolutionsCode("WLB_KXZP");
obj1.setConsignInfo(obj2);
obj1.setOrderSource(1L);
req.setConsignTopRequest(obj1);
CainiaoOrderLogisticsConsignResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
CainiaoOrderLogisticsConsignRequest req = new CainiaoOrderLogisticsConsignRequest();
ConsignTopRequestDto obj1 = new ConsignTopRequestDto();
obj1.ConfirmConsign = false;
obj1.AppName = "appkey123";
ConsignTopInfoDto obj2 = new ConsignTopInfoDto();
StoreServiceDto obj3 = new StoreServiceDto();
obj3.StoreCode = "WH001";
obj3.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.StoreServiceDto= obj3;
ConsignContactDto obj4 = new ConsignContactDto();
obj4.ContactId = 123456L;
obj4.MobilePhone = "13322224444";
obj4.Ddd = "0571";
obj4.Remark = "备注";
obj4.Address = "浙江省杭州市西湖区文二路398号";
obj4.WangwangId = "XXX店铺";
obj4.ContactName = "郭德纲";
obj4.ZipCode = "123000";
obj4.Branch = "890";
obj4.Telephone = "88602334";
obj4.AreaId = 330106L;
obj4.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.ReceiverContact= obj4;
obj2.Remark = "备注";
AppointServiceDto obj5 = new AppointServiceDto();
obj5.OsDate = "20150518";
obj5.OsRange = "09:00-18:00";
obj5.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.AppointServiceDto= obj5;
ConsignContactDto obj6 = new ConsignContactDto();
obj6.ContactId = 123456L;
obj6.MobilePhone = "13322224444";
obj6.Ddd = "0571";
obj6.Remark = "备注";
obj6.Address = "浙江省杭州市西湖区文二路398号";
obj6.WangwangId = "XXX店铺";
obj6.ContactName = "郭德纲";
obj6.ZipCode = "123000";
obj6.Branch = "890";
obj6.Telephone = "88602334";
obj6.AreaId = 330106L;
obj6.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.SenderContact= obj6;
obj2.OutTradeNo = "123456";
obj2.ConsignType = 0L;
InvoinceServiceDto obj7 = new InvoinceServiceDto();
obj7.BillType = 1L;
obj7.BillTitle = "XXX公司";
obj7.BillAmount = 100L;
obj7.BillContent = "发票内容";
obj7.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.InvoinceServiceDto= obj7;
ConsignContactDto obj8 = new ConsignContactDto();
obj8.ContactId = 123456L;
obj8.MobilePhone = "13322224444";
obj8.Ddd = "0571";
obj8.Remark = "备注";
obj8.Address = "浙江省杭州市西湖区文二路398号";
obj8.WangwangId = "XXX店铺";
obj8.ContactName = "郭德纲";
obj8.ZipCode = "123000";
obj8.Branch = "890";
obj8.Telephone = "88602334";
obj8.AreaId = 330106L;
obj8.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.RefundContact= obj8;
List<ConsignGoodsDto> list10 = new List<ConsignGoodsDto>();
ConsignGoodsDto obj11 = new ConsignGoodsDto();
list10.Add(obj11);
obj11.ItemName = "衣服";
obj11.Remark = "备注";
obj11.OutSubTradeNo = "123456";
obj11.ProviderId = 123456L;
obj11.Quantity = 10L;
obj11.ItemPrice = 1000L;
obj11.ItemId = "123456";
obj11.ItemCode = "A-001";
obj11.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj11.SkuId = 123L;
ConsignPackageDto obj12 = new ConsignPackageDto();
obj12.PackageWeight = "0.1";
obj12.PackageLength = "0.1";
obj12.PackageHeight = "0.1";
obj12.PackageId = 123456L;
obj12.PackageVolume = "0.1";
obj12.PackageWidth = "0.1";
obj11.ConsignPackageDto= obj12;
obj11.IsScItem = false;
obj2.ConsignGoods= list10;
obj2.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
TmsServiceDto obj13 = new TmsServiceDto();
obj13.MailNo = "1106359157302";
obj13.CpName = "中国邮政速递物流";
obj13.CpCode = "EMS";
obj13.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj2.TmsServiceDto= obj13;
obj2.SellerId = 123456L;
TmsGotServiceDto obj14 = new TmsGotServiceDto();
obj14.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
ConsignContactDto obj15 = new ConsignContactDto();
obj15.ContactId = 123456L;
obj15.MobilePhone = "13322224444";
obj15.Ddd = "0571";
obj15.Remark = "备注";
obj15.Address = "浙江省杭州市西湖区文二路398号";
obj15.WangwangId = "XXX店铺";
obj15.ContactName = "郭德纲";
obj15.ZipCode = "123000";
obj15.Branch = "890";
obj15.Telephone = "88602334";
obj15.AreaId = 330106L;
obj15.ExtendFields = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
obj14.GotAddress= obj15;
obj14.GotDate = "20150501";
obj14.GotRange = "09:00-10:00";
obj2.TmsGotServiceDto= obj14;
obj2.LogisticsSolutionsCode = "WLB_KXZP";
obj1.ConsignInfo= obj2;
obj1.OrderSource = 1L;
req.ConsignTopRequest_ = obj1;
CainiaoOrderLogisticsConsignResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new CainiaoOrderLogisticsConsignRequest;
$consign_top_request = new ConsignTopRequestDto;
$consign_top_request->confirm_consign="false";
$consign_top_request->app_name="appkey123";
$consign_info = new ConsignTopInfoDto;
$store_service_dto = new StoreServiceDto;
$store_service_dto->store_code="WH001";
$store_service_dto->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->store_service_dto = $store_service_dto;
$receiver_contact = new ConsignContactDto;
$receiver_contact->contact_id="123456";
$receiver_contact->mobile_phone="13322224444";
$receiver_contact->ddd="0571";
$receiver_contact->remark="备注";
$receiver_contact->address="浙江省杭州市西湖区文二路398号";
$receiver_contact->wangwang_id="XXX店铺";
$receiver_contact->contact_name="郭德纲";
$receiver_contact->zip_code="123000";
$receiver_contact->branch="890";
$receiver_contact->telephone="88602334";
$receiver_contact->area_id="330106";
$receiver_contact->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->receiver_contact = $receiver_contact;
$consign_info->remark="备注";
$appoint_service_dto = new AppointServiceDto;
$appoint_service_dto->os_date="20150518";
$appoint_service_dto->os_range="09:00-18:00";
$appoint_service_dto->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->appoint_service_dto = $appoint_service_dto;
$sender_contact = new ConsignContactDto;
$sender_contact->contact_id="123456";
$sender_contact->mobile_phone="13322224444";
$sender_contact->ddd="0571";
$sender_contact->remark="备注";
$sender_contact->address="浙江省杭州市西湖区文二路398号";
$sender_contact->wangwang_id="XXX店铺";
$sender_contact->contact_name="郭德纲";
$sender_contact->zip_code="123000";
$sender_contact->branch="890";
$sender_contact->telephone="88602334";
$sender_contact->area_id="330106";
$sender_contact->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->sender_contact = $sender_contact;
$consign_info->out_trade_no="123456";
$consign_info->consign_type="0";
$invoince_service_dto = new InvoinceServiceDto;
$invoince_service_dto->bill_type="1";
$invoince_service_dto->bill_title="XXX公司";
$invoince_service_dto->bill_amount="100";
$invoince_service_dto->bill_content="发票内容";
$invoince_service_dto->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->invoince_service_dto = $invoince_service_dto;
$refund_contact = new ConsignContactDto;
$refund_contact->contact_id="123456";
$refund_contact->mobile_phone="13322224444";
$refund_contact->ddd="0571";
$refund_contact->remark="备注";
$refund_contact->address="浙江省杭州市西湖区文二路398号";
$refund_contact->wangwang_id="XXX店铺";
$refund_contact->contact_name="郭德纲";
$refund_contact->zip_code="123000";
$refund_contact->branch="890";
$refund_contact->telephone="88602334";
$refund_contact->area_id="330106";
$refund_contact->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->refund_contact = $refund_contact;
$consign_goods = new ConsignGoodsDto;
$consign_goods->item_name="衣服";
$consign_goods->remark="备注";
$consign_goods->out_sub_trade_no="123456";
$consign_goods->provider_id="123456";
$consign_goods->quantity="10";
$consign_goods->item_price="1000";
$consign_goods->item_id="123456";
$consign_goods->item_code="A-001";
$consign_goods->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_goods->sku_id="123";
$consign_package_dto = new ConsignPackageDto;
$consign_package_dto->package_weight="0.1";
$consign_package_dto->package_length="0.1";
$consign_package_dto->package_height="0.1";
$consign_package_dto->package_id="123456";
$consign_package_dto->package_volume="0.1";
$consign_package_dto->package_width="0.1";
$consign_goods->consign_package_dto = $consign_package_dto;
$consign_goods->is_sc_item="false";
$consign_info->consign_goods = $consign_goods;
$consign_info->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$tms_service_dto = new TmsServiceDto;
$tms_service_dto->mail_no="1106359157302";
$tms_service_dto->cp_name="中国邮政速递物流";
$tms_service_dto->cp_code="EMS";
$tms_service_dto->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$consign_info->tms_service_dto = $tms_service_dto;
$consign_info->seller_id="123456";
$tms_got_service_dto = new TmsGotServiceDto;
$tms_got_service_dto->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$got_address = new ConsignContactDto;
$got_address->contact_id="123456";
$got_address->mobile_phone="13322224444";
$got_address->ddd="0571";
$got_address->remark="备注";
$got_address->address="浙江省杭州市西湖区文二路398号";
$got_address->wangwang_id="XXX店铺";
$got_address->contact_name="郭德纲";
$got_address->zip_code="123000";
$got_address->branch="890";
$got_address->telephone="88602334";
$got_address->area_id="330106";
$got_address->extend_fields=json_decode("{\"key1\":\"value1\",\"key2\":\"value2\"}");
$tms_got_service_dto->got_address = $got_address;
$tms_got_service_dto->got_date="20150501";
$tms_got_service_dto->got_range="09:00-10:00";
$consign_info->tms_got_service_dto = $tms_got_service_dto;
$consign_info->logistics_solutions_code="WLB_KXZP";
$consign_top_request->consign_info = $consign_info;
$consign_top_request->order_source="1";
$req->setConsignTopRequest(json_encode($consign_top_request));
$resp = $c->execute($req, $sessionKey);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=taobao.cainiao.order.logistics.consign' \
-d 'partner_id=apidoc' \
-d 'session=9c3182c0-8d76-4493-a29b-f83625c6eedc' \
-d 'sign=FB1AE0B4A29FF658790129D4EA7D6A22' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-09-27+12%3A09%3A43' \
-d 'v=2.0' \
-d 'consign_top_request=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.CainiaoOrderLogisticsConsignRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.consign_top_request="数据结构示例JSON格式"
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.cainiao.order.logistics.consign");
add_param(pRequest,"consign_top_request","数据结构JSON示例");
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.cainiao.order.logistics.consign', {
'consign_top_request':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})