发布商品前,请确保以下条件已满足
已申请类目和品牌权限
你可以使用aliexpress.offer.product.post来发布商品。随后你可以使用aliexpress.offer.product.edit来编辑标题和描述。
上述API的大部分参数都在API文档里有详细的说明,你也可以参考本文附录里的请求示例。本文会介绍一些复杂的属性,它们在API文档里无法详细说明。
首先你需要为你的商品选择合适的类目。商品SKUs,商品一般属性、尺码模板等都跟选择的类目有关系。
速卖通的类目有多个层级,发布商品的时候必须选择叶子类目(即没有子类目的类目)。你可以递归使用
aliexpress.category.redefining.getchildrenpostcategorybyid 来获取整棵类目树。如果要获取一级类目,请使用0作为父类目ID。
请参考Get Child Categories里的请求/响应示例。
确定类目之后,你可以调用aliexpress.category.redefining.getchildattributesresultbypostcateidandpath来获得这个类目的属性列表,这些属性对发布商品很重要。这个API可以告诉你每个类目有哪些SKU属性和一般属性,哪些属性是必填的,以及某些属性有哪些可选值。请参考Get Category Attributes里的请求/响应示例。
{ ... "spec": 2, ? <-- 对SKU属性很重要! "required": false, <-- 重要! "keyAttribute": false, <-- 重要! "sku": false, <-- 重要! "id": 196, <-- 重要! "values": [ { "id": 134, "names": { "zh": "交流", "en": "AC" } }, ... ], "names": { "zh": "输出类型", "en": "Output Type" }, "inputType": "STRING", "attributeShowTypeValue": "list_box" }
发布商品的时候SKU属性和一般属性会放在不同的参数里。
一个商品可以有多个SKU,每个SKU是SKU属性的组合。一个商品有多少个SKU,决定于每个SKU属性有多少个值,它等于每个SKU属性可选值数量的乘积。
例如一件衬衫包含两个维度的SKU属性:颜色(3种:蓝、黑、绿)和尺码(4个:M、L、XL、XXL),那么最终可以组合出3*4=12个SKU。
上面已经提到过,我们可以使用aliexpress.category.redefining.getchildattributesresultbypostcateidandpath来获取一个类目的所有SKU属性。
请注意,发布商品时,每个SKU里SKU属性的排列顺序很重要。如果一个商品的SKU由多个SKU属性组合而成,那么它们必须按照该SKU属性的spec值按升序排列。
例如对衬衫(服装/服饰配件 -> 男装 -> 衬衫,类目id是348)来说,它包含如下3个SKU属性,它们的顺序必须为14、5、200007763。
{ "id":5, "names": "{\"zh\":\"尺寸\",\"en\":\"Size\"}", "sku": true, "spec":2 }, { "id": 14, "names": "{\"zh\":\"颜色\",\"en\":\"Color\"}", "sku": true, "spec": 1 }, { "id": 200007763, "names": "{\"zh\":\"发货地\",\"en\":\"Ships From\"}", "sku": true, "spec": 3 }
商品SKU里的每个SKU属性有四个字段,属性ID及属性值ID是从类目的SKU属性里获得,而名称和图片你可以定义自己的值,例如:
skuProperty.setSkuPropertyId(200009209); <--- 属性ID(从类目的SKU属性里获得) skuProperty.setPropertyValueId(200660849); <--- 属性值ID(从类目的SKU属性里获得) skuProperty.setPropertyValueDefinitionName("pink"); <--- 自定义颜色名称 skuProperty.setSkuImage("http://***.jpg"); <--- 上传SKU图片并在这里使用
除了SKU属性,我们还使用一般属性来描述商品,例如品牌、材质等。
有两种一般属性
下面这个表指明了发布商品时这两种属性对应的各字段是否是必填的。
类型 | 条件 | attr_name_id | attr_value_id | attr_name | attr_value |
---|---|---|---|---|---|
系统属性 | 定义了可选的值,并且没有“Other”选项 | 必须 | 必须 | 不合法 | 不合法 |
系统属性 | 没有定义可选值 | 必须 | 不合法 | 不合法 | 必须 |
系统属性 | 可选的值里有“Other”选项 | 必须 | 必须 | invalid | 当值=Other时必须 |
自定义属性 | 不合法 | 不合法 | 必须 | 必须 |
下面是系统属性的一些示例:
定义了所有可选值的系统属性
没有定义任何可选值的系统属性
包含“Other”选项的系统属性
你可以使用aliexpress.photobank.redefining.uploadimageforsdk来上传商品的图片及商品详情里的图片。如果要列举速卖通图片银行里的所有图片,请使用aliexpress.photobank.redefining.listimagepagination。图片银行里的图片可以用分组来管理,创建分组的操作目前只能在速卖通网站上完成,但你可以通过aliexpress.photobank.redefining.listgroup列举出所有的分组。
注意图片银行是有容量限制的。你可以通过aliexpress.photobank.redefining.getphotobankinfo来获取容量限制及当前的使用情况。
发布商品时需要选择一个运费模板。你可以使用aliexpress.freight.redefining.listfreighttemplate列举出所有的运费模板。
发布商品时需要选择一个服务模板。你可以使用aliexpress.postproduct.redefining.querypromisetemplatebyid来列举出所有的服务模板(设置template_id为-1即可获取所有服务模板)。
尺码模板有助于展示服饰类商品的准确尺寸。它是可选的,如果你希望尽快的发布商品,可以先忽略它,后续再补上(aliexpress.postproduct.redefining.setsizechart)。
你可以使用aliexpress.offer.redefining.getsizetemplatesbycategoryid获取叶子类目的所有可用的尺码模板。
如果不同类目有相同的尺码模板,你可以只创建一个,然后使用aliexpress.offer.redefining.copysizetemplate复制它到其他类目。
如果你想知道某个尺码模板被哪些商品使用了,可以使用aliexpress.offer.redefining.getcanusedproductbysizetemplateid。
商品详情里可以包含图片,直接使用HTML的image实体就可以,图片地址必须是速卖通图片银行的图片(请参考上面上传图片的章节),例如
Product instruction image below:\n<img src="http://ae01.alicdn.com/kf/HTB14h.DRVXXXXa7XXXXq6xXFXXXm.jpg" alt="Smiley face" height="142" width="142">
目前无法通过API上传视频。使用API发布商品时,如果要用到视频,只能复制别的商品的视频,需要按如下方式进行
产品信息模块是一种新的管理产品信息的方式,您可以为产品信息中的公共信息(例如售后物流政策等)单独创建一个模块,并在产品中引用。如果您需要修改这些信息,只需要修改相应的模块即可。模块除了可以放置公共信息外,还可以放置关联产品(已上线)、限时打折等(开发中)。
产品信息模块只能在卖家后台创建,但是可以通过API查询,包括aliexpress.postproduct.redefining.findaeproductdetailmodulelistbyqurey( 查询信息模板列表 )和aliexpress.postproduct.redefining.findaeproductmodulebyid( 查询单个信息模板详情 )。
在商品详情中可以加入产品信息模块,示例如下:
自定义模块
<kse:widget data-widget-type="customText" id="3***9" title="title" type="custom"></kse:widget>
关联产品模块
<kse:widget data-widget-type="relatedProduct" id="2***1" title="title" type="relation"></kse:widget>
字段名 | 校验 |
---|---|
币种权限 | a. 个数:每个卖家最多只有一种原发语种的权限; b. 接口:aliexpress.merchant.profile.get, 通过接口获取卖家币种权限; c. 链接:https://developers.aliexpress.com/api.htm?spm=a219a.7386797.0.0.231a669a1r9IaG&source=search&docId=43062&docType=2 d. 判断值:返回字段值quotation_currency; |
类目必填属性 | a. 接口: aliexpress.category.redefining.getchildattributesresultbypostcateidandpath; b. 链接:https://developers.aliexpress.com/api.htm?spm=a219a.7386797.0.0.6d2f669aBfE4so&source=search&docId=29988&docType=2 c. 判断值:返回字段值aeop_attribute_dto.required值判断,属性是否属于必填; |
校验场景 | 校验说明 | Case样例 |
---|---|---|
sku属性不能重复 | 每个sku的aeop_s_k_u_property是唯一的,不能重复 | “aeop_ae_product_s_k_us”:[ { “aeop_s_k_u_property”:[ { “property_value_id”:771, “sku_property_id”:14 } ] }, { “aeop_s_k_u_property”:[ { “property_value_id”:771, “sku_property_id”:14 } ] } ] |
sku的属性维度保持一致 | 每个sku的aeop_s_k_u_property中数组元素个数保持一致 | |
sku属性值不能为空 | 即每个aeop_s_k_u_property元素不能为空 | “aeop_ae_product_s_k_us”: [ { “aeop_s_k_u_property”: [ { “property_value_id”: 771, “sku_property_id”: 14 } ] }, { “aeop_s_k_u_property”: [ { “property_value_id”: "“, ”sku_property_id“: ”" } ] } ] |
发布一个双肩包,无sku属性、无分国家报价
{ //1. Product Information "subject_list": [ { "locale": "en_US", "value": "test new post api" } ], "category_id": 152401, "image_u_r_ls": "http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg", "aeop_ae_product_propertys": [ { "attr_name_id": 200000137, "attr_value_id": 200001583 }, { "attr_name_id": 20205, "attr_value_id": 365212 }, { "attr_name_id": 2, "attr_value_id": 200659476 } ], //2. Price and Inventory "product_unit": 100000015, "is_pack_sell": false, "aeop_ae_product_s_k_us": [ { "aeop_s_k_u_property": [], "currency_code": "USD", "ipm_sku_stock": 12, "sku_price": "8888.0", "sku_stock": false } ], "product_price": "8888.00", "currency_code": "USD", //3. Detail Page "locale": "en_US", "detail_source_list": [ { "locale": "en_US", "mobile_detail": "{\"version\":\"2.0.0\",\"moduleList\":[{\"type\":\"text-image\",\"texts\":[{\"content\":\"Brand Story\",\"class\":\"title\"}],\"images\":[{\"url\":\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\",\"style\":{\"width\":700,\"height\":296}}]},{\"type\":\"text\",\"texts\":[{\"content\":\"Describe your brand story, including establishment and development timelines, milestones, etc.\",\"class\":\"body\"}]}]}" } ], //4.Packaging and Logistics "delivery_time": 7, "gross_weight": "0.500", "lot_num": 1, "add_weight": "null", "package_height": 10, "package_length": 50, "package_type": false, "package_width": 30, "freight_template_id": 1000, "promise_template_id": 0, //5. Other Settings "reduce_strategy": "payment_success_deduct", "ws_valid_num": 30 }
{ "aliexpress_offer_product_post_response": { "result": { "product_id": 33009515412 }, "request_id": "zg4wtq68m309" } }
{ AeopAEProduct aeopAEProduct = new AeopAEProduct(); //1. Product Information List<Subject> subjects = new ArrayList<Subject>(); Subject subject = new Subject(); subjects.add(subject); subject.setLocale("en_US"); subject.setValue("test new post api"); aeopAEProduct.setSubjectList(subjects); aeopAEProduct.setLocale("en_US"); //1.1 Category: Luggage & Bags -> Backpacks(152401L) Long categoryId = 152401L; aeopAEProduct.setCategoryId(categoryId); aeopAEProduct.setImageURLs("http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg;http://g02.a.alicdn.com/kf/HTB1q1aLJXXXXXcfaXXXq6xXFXXXv.jpg"); //1.2. System property List<AeopAeProductProperty> aeopAeProductProperties = new ArrayList<AeopAeProductProperty>(); AeopAeProductProperty aeopAeProductProperty1 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty1); aeopAeProductProperty1.setAttrNameId(200000137); aeopAeProductProperty1.setAttrValueIdLong(200001583L); AeopAeProductProperty aeopAeProductProperty2 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty2); aeopAeProductProperty2.setAttrNameId(20205); aeopAeProductProperty2.setAttrValueIdLong(365212L); AeopAeProductProperty aeopAeProductProperty3 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty3); aeopAeProductProperty3.setAttrNameId(2); aeopAeProductProperty3.setAttrValueIdLong(200659476L); aeopAEProduct.setAeopAeProductPropertys(aeopAeProductProperties); //2. Price and Inventory aeopAEProduct.setProductUnit(100000015L); aeopAEProduct.setIsPackSell(false); aeopAEProduct.setProductPrice("8888.00"); aeopAEProduct.setCurrencyCode("USD"); List<AeopAEProductSKU> aeopAEProductSKUS = new ArrayList<AeopAEProductSKU>(); AeopAEProductSKU aeopAEProductSKU1 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU1); List<AeopSKUProperty> aeopSKUProperties = new ArrayList<AeopSKUProperty>(); aeopAEProductSKU1.setAeopSKUProperty(aeopSKUProperties); //aeopAEProductSKU1.setBarcode("AEfgsdg334"); aeopAEProductSKU1.setCurrencyCode("USD"); aeopAEProductSKU1.setIpmSkuStock(12); aeopAEProductSKU1.setSkuPrice("8888.0"); aeopAEProduct.setAeopAeProductSKUs(aeopAEProductSKUS); //3. Detail Page List<DetailSource> detailSources = new ArrayList<DetailSource>(); DetailSource detailSource = new DetailSource(); detailSources.add(detailSource); detailSource.setLocale("en_US"); detailSource.setWebDetail("web detail info"); detailSource.setMobileDetail("{\\\"version\\\":\\\"2.0.0\\\",\\\"moduleList\\\":[{\\\"type\\\":\\\"text-image\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Brand Story\\\",\\\"class\\\":\\\"title\\\"}],\\\"images\\\":[{\\\"url\\\":\\\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\\\",\\\"style\\\":{\\\"width\\\":700,\\\"height\\\":296}}]},{\\\"type\\\":\\\"text\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Describe your brand story, including establishment and development timelines, milestones, etc.\\\",\\\"class\\\":\\\"body\\\"}]}]}\"\n"); aeopAEProduct.setDetailSourceList(detailSources); //4. Packaging and Logistics aeopAEProduct.setDeliveryTime(7L); aeopAEProduct.setGrossWeight("0.500"); aeopAEProduct.setLotNum(1L); aeopAEProduct.setPackageLength(50); aeopAEProduct.setPackageHeight(10); aeopAEProduct.setPackageType(false); aeopAEProduct.setPackageWidth(30); aeopAEProduct.setFreightTemplateId(1000); aeopAEProduct.setPromiseTemplateId(0L); //5. Other Settings aeopAEProduct.setReduceStrategy("place_order_withhold or payment_success_deduct"); aeopAEProduct.setWsValidNum(30L); String apiName = "aliexpress.offer.product.post"; Map<String, String> params = new HashMap<String, String>(); params.put("product", new JSONObject(aeopAEProduct).toString()); JSONObject jsonResponse = ApiInvoker.invokeApi(appKey, appSecret, accessToken, apiName, params); }
发布一个双肩包,有两维sku属性,分别是颜色(红色,蓝色)、尺寸(13寸、14寸):
{ //1. Product Information "subject_list": [ { "locale": "en_US", "value": "test new post api" } ], "category_id": 152401, "image_u_r_ls": "http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg", "aeop_ae_product_propertys": [ { "attr_name_id": 200000137, "attr_value_id": 200001583 }, { "attr_name_id": 20205, "attr_value_id": 365212 }, { "attr_name_id": 2, "attr_value_id": 200659476 } ], //2. Price and Inventory "product_unit": 100000015, "is_pack_sell": false, "aeop_ae_product_s_k_us": [ { "aeop_s_k_u_property": [], "currency_code": "USD", "ipm_sku_stock": 12, "sku_price": "8888.0", "sku_stock": false } ], "product_price": "8888.00", "currency_code": "USD", "aeop_ae_product_s_k_us": [ { "aeop_s_k_u_property": [ { "property_value_id": 771, "sku_property_id": 14 }, { "property_value_id": 311, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:771;5:311", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 771, "sku_property_id": 14 }, { "property_value_id": 312, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:771;5:312", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 173, "sku_property_id": 14 }, { "property_value_id": 311, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:173;5:311", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 173, "sku_property_id": 14 }, { "property_value_id": 312, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:173;5:312", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false } ], //3. Detail Page "locale": "en_US", "detail_source_list": [ { "locale": "en_US", "mobile_detail": "{\"version\":\"2.0.0\",\"moduleList\":[{\"type\":\"text-image\",\"texts\":[{\"content\":\"Brand Story\",\"class\":\"title\"}],\"images\":[{\"url\":\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\",\"style\":{\"width\":700,\"height\":296}}]},{\"type\":\"text\",\"texts\":[{\"content\":\"Describe your brand story, including establishment and development timelines, milestones, etc.\",\"class\":\"body\"}]}]}" } ], //4.Packaging and Logistics "delivery_time": 7, "gross_weight": "0.500", "lot_num": 1, "add_weight": "null", "package_height": 10, "package_length": 50, "package_type": false, "package_width": 30, "freight_template_id": 1000, "promise_template_id": 0, //5. Other Settings "reduce_strategy": "payment_success_deduct", "ws_valid_num": 30 }
{ "aliexpress_offer_product_post_response": { "result": { "product_id": 33009539054 }, "request_id": "sab6ywm0bn3x" } }
{ AeopAEProduct aeopAEProduct = new AeopAEProduct(); //1. Product Information List<Subject> subjects = new ArrayList<Subject>(); Subject subject = new Subject(); subjects.add(subject); subject.setLocale("en_US"); subject.setValue("test new post api"); aeopAEProduct.setSubjectList(subjects); aeopAEProduct.setLocale("en_US"); //1.1 Category: Luggage & Bags -> Backpacks(152401L) Long categoryId = 152401L; aeopAEProduct.setCategoryId(categoryId); aeopAEProduct.setImageURLs("http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg;http://g02.a.alicdn.com/kf/HTB1q1aLJXXXXXcfaXXXq6xXFXXXv.jpg"); //1.2. System property List<AeopAeProductProperty> aeopAeProductProperties = new ArrayList<AeopAeProductProperty>(); AeopAeProductProperty aeopAeProductProperty1 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty1); aeopAeProductProperty1.setAttrNameId(200000137); aeopAeProductProperty1.setAttrValueIdLong(200001583L); AeopAeProductProperty aeopAeProductProperty2 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty2); aeopAeProductProperty2.setAttrNameId(20205); aeopAeProductProperty2.setAttrValueIdLong(365212L); AeopAeProductProperty aeopAeProductProperty3 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty3); aeopAeProductProperty3.setAttrNameId(2); aeopAeProductProperty3.setAttrValueIdLong(200659476L); aeopAEProduct.setAeopAeProductPropertys(aeopAeProductProperties); //2. Price and Inventory aeopAEProduct.setProductUnit(100000015L); aeopAEProduct.setIsPackSell(false); aeopAEProduct.setProductPrice("8888.00"); aeopAEProduct.setCurrencyCode("USD"); //2.1 SKU price List<AeopSKUProperty> aeopSKUProperties = new ArrayList<AeopSKUProperty>(); AeopSKUProperty aeopSKUProperty11 = new AeopSKUProperty(); aeopSKUProperty11.setSkuPropertyId(14); aeopSKUProperty11.setPropertyValueIdLong(771L); AeopSKUProperty aeopSKUProperty12 = new AeopSKUProperty(); aeopSKUProperty12.setSkuPropertyId(14); aeopSKUProperty12.setPropertyValueIdLong(173L); AeopSKUProperty aeopSKUProperty21 = new AeopSKUProperty(); aeopSKUProperty21.setSkuPropertyId(5); aeopSKUProperty21.setPropertyValueIdLong(312L); AeopSKUProperty aeopSKUProperty22 = new AeopSKUProperty(); aeopSKUProperty22.setSkuPropertyId(5); aeopSKUProperty22.setPropertyValueIdLong(311L); List<AeopAEProductSKU> aeopAEProductSKUS = new ArrayList<AeopAEProductSKU>(); AeopAEProductSKU aeopAEProductSKU1 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU1); List<AeopSKUProperty> aeopSKUProperties1 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties1.add(aeopSKUProperty11); aeopSKUProperties1.add(aeopSKUProperty21); aeopAEProductSKU1.setAeopSKUProperty(aeopSKUProperties1); //aeopAEProductSKU1.setBarcode("AEfgsdg334"); aeopAEProductSKU1.setCurrencyCode("USD"); aeopAEProductSKU1.setIpmSkuStock(12L); aeopAEProductSKU1.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU2 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU2); List<AeopSKUProperty> aeopSKUProperties2 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties2.add(aeopSKUProperty11); aeopSKUProperties2.add(aeopSKUProperty22); aeopAEProductSKU2.setAeopSKUProperty(aeopSKUProperties2); //aeopAEProductSKU2.setBarcode("AEfgsdg334"); aeopAEProductSKU2.setCurrencyCode("USD"); aeopAEProductSKU2.setIpmSkuStock(12L); aeopAEProductSKU2.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU3 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU3); List<AeopSKUProperty> aeopSKUProperties3 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties3.add(aeopSKUProperty12); aeopSKUProperties3.add(aeopSKUProperty21); aeopAEProductSKU3.setAeopSKUProperty(aeopSKUProperties3); //aeopAEProductSKU3.setBarcode("AEfgsdg334"); aeopAEProductSKU3.setCurrencyCode("USD"); aeopAEProductSKU3.setIpmSkuStock(12L); aeopAEProductSKU3.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU4 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU4); List<AeopSKUProperty> aeopSKUProperties4 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties4.add(aeopSKUProperty12); aeopSKUProperties4.add(aeopSKUProperty22); aeopAEProductSKU4.setAeopSKUProperty(aeopSKUProperties4); //aeopAEProductSKU4.setBarcode("AEfgsdg334"); aeopAEProductSKU4.setCurrencyCode("USD"); aeopAEProductSKU4.setIpmSkuStock(12L); aeopAEProductSKU4.setSkuPrice("8886.0"); aeopAEProduct.setAeopAeProductSKUs(aeopAEProductSKUS); //3. Detail Page List<DetailSource> detailSources = new ArrayList<DetailSource>(); DetailSource detailSource = new DetailSource(); detailSources.add(detailSource); detailSource.setLocale("en_US"); detailSource.setWebDetail("web detail info"); detailSource.setMobileDetail("{\\\"version\\\":\\\"2.0.0\\\",\\\"moduleList\\\":[{\\\"type\\\":\\\"text-image\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Brand Story\\\",\\\"class\\\":\\\"title\\\"}],\\\"images\\\":[{\\\"url\\\":\\\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\\\",\\\"style\\\":{\\\"width\\\":700,\\\"height\\\":296}}]},{\\\"type\\\":\\\"text\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Describe your brand story, including establishment and development timelines, milestones, etc.\\\",\\\"class\\\":\\\"body\\\"}]}]}\"\n"); aeopAEProduct.setDetailSourceList(detailSources); //4. Packaging and Logistics aeopAEProduct.setDeliveryTime(7L); aeopAEProduct.setGrossWeight("0.500"); aeopAEProduct.setLotNum(1L); aeopAEProduct.setPackageLength(50); aeopAEProduct.setPackageHeight(10); aeopAEProduct.setPackageType(false); aeopAEProduct.setPackageWidth(30); aeopAEProduct.setFreightTemplateId(1000); aeopAEProduct.setPromiseTemplateId(0L); //5. Other Settings aeopAEProduct.setReduceStrategy("place_order_withhold or payment_success_deduct"); aeopAEProduct.setWsValidNum(30L); String apiName = "aliexpress.offer.product.post"; Map<String, String> params = new HashMap<String, String>(); params.put("product", new JSONObject(aeopAEProduct).toString()); JSONObject jsonResponse = ApiInvoker.invokeApi(appKey, appSecret, accessToken, apiName, params); }
{ //1. Product Information "subject_list": [ { "locale": "en_US", "value": "test new post api" } ], "category_id": 152401, "image_u_r_ls": "http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg", "aeop_ae_product_propertys": [ { "attr_name_id": 200000137, "attr_value_id": 200001583 }, { "attr_name_id": 20205, "attr_value_id": 365212 }, { "attr_name_id": 2, "attr_value_id": 200659476 } ], //2. Price and Inventory "product_unit": 100000015, "is_pack_sell": false, "aeop_ae_product_s_k_us": [ { "aeop_s_k_u_property": [], "currency_code": "USD", "ipm_sku_stock": 12, "sku_price": "8888.0", "sku_stock": false } ], "product_price": "8888.00", "currency_code": "USD", "aeop_ae_product_s_k_us": [ { "aeop_s_k_u_property": [ { "property_value_id": 771, "sku_property_id": 14 }, { "property_value_id": 311, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:771;5:311", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 771, "sku_property_id": 14 }, { "property_value_id": 312, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:771;5:312", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 173, "sku_property_id": 14 }, { "property_value_id": 311, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:173;5:311", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false }, { "aeop_s_k_u_property": [ { "property_value_id": 173, "sku_property_id": 14 }, { "property_value_id": 312, "sku_property_id": 5 } ], "currency_code": "USD", "id": "14:173;5:312", "ipm_sku_stock": 10, "sku_price": "8886.0", "sku_stock": false } ], "aeop_national_quote_configuration": { "configuration_data": "[{\"absoluteQuoteMap\":{\"14:771;5:311\":12.0},\"shiptoCountry\":\"RU\"},{\"absoluteQuoteMap\":{\"14:771;5:311\":-10.0},\"shiptoCountry\":\"ES\"}]", "configuration_type": "relative" }, //3. Detail Page "locale": "en_US", "detail_source_list": [ { "locale": "en_US", "mobile_detail": "{\"version\":\"2.0.0\",\"moduleList\":[{\"type\":\"text-image\",\"texts\":[{\"content\":\"Brand Story\",\"class\":\"title\"}],\"images\":[{\"url\":\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\",\"style\":{\"width\":700,\"height\":296}}]},{\"type\":\"text\",\"texts\":[{\"content\":\"Describe your brand story, including establishment and development timelines, milestones, etc.\",\"class\":\"body\"}]}]}" } ], //4.Packaging and Logistics "delivery_time": 7, "gross_weight": "0.500", "lot_num": 1, "add_weight": "null", "package_height": 10, "package_length": 50, "package_type": false, "package_width": 30, "freight_template_id": 1000, "promise_template_id": 0, //5. Other Settings "reduce_strategy": "payment_success_deduct", "ws_valid_num": 30 }
{ "aliexpress_offer_product_post_response": { "result": { "product_id": 33008948515 }, "request_id": "54sycq1o7vme" } }
{ AeopAEProduct aeopAEProduct = new AeopAEProduct(); //1. Product Information List<Subject> subjects = new ArrayList<Subject>(); Subject subject = new Subject(); subjects.add(subject); subject.setLocale("en_US"); subject.setValue("test new post api"); aeopAEProduct.setSubjectList(subjects); aeopAEProduct.setLocale("en_US"); //1.1 Category: Luggage & Bags -> Backpacks(152401L) Long categoryId = 152401L; aeopAEProduct.setCategoryId(categoryId); aeopAEProduct.setImageURLs("http://ae01.alicdn.com/kf/HLB1XxDQRNTpK1RjSZFKq6y2wXXam.jpg;http://g02.a.alicdn.com/kf/HTB1q1aLJXXXXXcfaXXXq6xXFXXXv.jpg"); //1.2. System property List<AeopAeProductProperty> aeopAeProductProperties = new ArrayList<AeopAeProductProperty>(); AeopAeProductProperty aeopAeProductProperty1 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty1); aeopAeProductProperty1.setAttrNameId(200000137); aeopAeProductProperty1.setAttrValueIdLong(200001583L); AeopAeProductProperty aeopAeProductProperty2 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty2); aeopAeProductProperty2.setAttrNameId(20205); aeopAeProductProperty2.setAttrValueIdLong(365212L); AeopAeProductProperty aeopAeProductProperty3 = new AeopAeProductProperty(); aeopAeProductProperties.add(aeopAeProductProperty3); aeopAeProductProperty3.setAttrNameId(2); aeopAeProductProperty3.setAttrValueIdLong(200659476L); aeopAEProduct.setAeopAeProductPropertys(aeopAeProductProperties); //2. Price and Inventory aeopAEProduct.setProductUnit(100000015L); aeopAEProduct.setIsPackSell(false); aeopAEProduct.setProductPrice("8888.00"); aeopAEProduct.setCurrencyCode("USD"); //2.1 SKU price List<AeopSKUProperty> aeopSKUProperties = new ArrayList<AeopSKUProperty>(); AeopSKUProperty aeopSKUProperty11 = new AeopSKUProperty(); aeopSKUProperty11.setSkuPropertyId(14); aeopSKUProperty11.setPropertyValueIdLong(771L); AeopSKUProperty aeopSKUProperty12 = new AeopSKUProperty(); aeopSKUProperty12.setSkuPropertyId(14); aeopSKUProperty12.setPropertyValueIdLong(173L); AeopSKUProperty aeopSKUProperty21 = new AeopSKUProperty(); aeopSKUProperty21.setSkuPropertyId(5); aeopSKUProperty21.setPropertyValueIdLong(312L); AeopSKUProperty aeopSKUProperty22 = new AeopSKUProperty(); aeopSKUProperty22.setSkuPropertyId(5); aeopSKUProperty22.setPropertyValueIdLong(311L); List<AeopAEProductSKU> aeopAEProductSKUS = new ArrayList<AeopAEProductSKU>(); AeopAEProductSKU aeopAEProductSKU1 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU1); List<AeopSKUProperty> aeopSKUProperties1 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties1.add(aeopSKUProperty11); aeopSKUProperties1.add(aeopSKUProperty21); aeopAEProductSKU1.setAeopSKUProperty(aeopSKUProperties1); //aeopAEProductSKU1.setBarcode("AEfgsdg334"); aeopAEProductSKU1.setCurrencyCode("USD"); aeopAEProductSKU1.setIpmSkuStock(12L); aeopAEProductSKU1.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU2 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU2); List<AeopSKUProperty> aeopSKUProperties2 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties2.add(aeopSKUProperty11); aeopSKUProperties2.add(aeopSKUProperty22); aeopAEProductSKU2.setAeopSKUProperty(aeopSKUProperties2); //aeopAEProductSKU2.setBarcode("AEfgsdg334"); aeopAEProductSKU2.setCurrencyCode("USD"); aeopAEProductSKU2.setIpmSkuStock(12L); aeopAEProductSKU2.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU3 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU3); List<AeopSKUProperty> aeopSKUProperties3 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties3.add(aeopSKUProperty12); aeopSKUProperties3.add(aeopSKUProperty21); aeopAEProductSKU3.setAeopSKUProperty(aeopSKUProperties3); //aeopAEProductSKU3.setBarcode("AEfgsdg334"); aeopAEProductSKU3.setCurrencyCode("USD"); aeopAEProductSKU3.setIpmSkuStock(12L); aeopAEProductSKU3.setSkuPrice("8886.0"); AeopAEProductSKU aeopAEProductSKU4 = new AeopAEProductSKU(); aeopAEProductSKUS.add(aeopAEProductSKU4); List<AeopSKUProperty> aeopSKUProperties4 = new ArrayList<AeopSKUProperty>(); aeopSKUProperties4.add(aeopSKUProperty12); aeopSKUProperties4.add(aeopSKUProperty22); aeopAEProductSKU4.setAeopSKUProperty(aeopSKUProperties4); //aeopAEProductSKU4.setBarcode("AEfgsdg334"); aeopAEProductSKU4.setCurrencyCode("USD"); aeopAEProductSKU4.setIpmSkuStock(12L); aeopAEProductSKU4.setSkuPrice("8886.0"); aeopAEProduct.setAeopAeProductSKUs(aeopAEProductSKUS); //2.2. National quote AeopNationalQuoteConfiguration aeopNationalQuoteConfiguration = new AeopNationalQuoteConfiguration(); aeopNationalQuoteConfiguration.setConfigurationData("[{\"absoluteQuoteMap\":{\"14:173;5:311\":12.0},\"shiptoCountry\":\"RU\"},{\"absoluteQuoteMap\":{\"14:173;5:311\":-10.0},\"shiptoCountry\":\"ES\"}]"); aeopNationalQuoteConfiguration.setConfigurationType("percentage or relative"); aeopAEProduct.setAeopNationalQuoteConfiguration(aeopNationalQuoteConfiguration); //3. Detail Page List<DetailSource> detailSources = new ArrayList<DetailSource>(); DetailSource detailSource = new DetailSource(); detailSources.add(detailSource); detailSource.setLocale("en_US"); detailSource.setWebDetail("web detail info"); detailSource.setMobileDetail("{\\\"version\\\":\\\"2.0.0\\\",\\\"moduleList\\\":[{\\\"type\\\":\\\"text-image\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Brand Story\\\",\\\"class\\\":\\\"title\\\"}],\\\"images\\\":[{\\\"url\\\":\\\"//ae01.alicdn.com/kf/HTB1QuVqacfrK1RkSmLy760GApXaG.png\\\",\\\"style\\\":{\\\"width\\\":700,\\\"height\\\":296}}]},{\\\"type\\\":\\\"text\\\",\\\"texts\\\":[{\\\"content\\\":\\\"Describe your brand story, including establishment and development timelines, milestones, etc.\\\",\\\"class\\\":\\\"body\\\"}]}]}\"\n"); aeopAEProduct.setDetailSourceList(detailSources); //4. Packaging and Logistics aeopAEProduct.setDeliveryTime(7L); aeopAEProduct.setGrossWeight("0.500"); aeopAEProduct.setLotNum(1L); aeopAEProduct.setPackageLength(50); aeopAEProduct.setPackageHeight(10); aeopAEProduct.setPackageType(false); aeopAEProduct.setPackageWidth(30); aeopAEProduct.setFreightTemplateId(1000); aeopAEProduct.setPromiseTemplateId(0L); //5. Other Settings aeopAEProduct.setReduceStrategy("place_order_withhold or payment_success_deduct"); aeopAEProduct.setWsValidNum(30L); String apiName = "aliexpress.offer.product.post"; Map<String, String> params = new HashMap<String, String>(); params.put("product", new JSONObject(aeopAEProduct).toString()); JSONObject jsonResponse = ApiInvoker.invokeApi(appKey, appSecret, accessToken, apiName, params); }