product release


1. Document description

This document is targeted at Tmall/Taobao (insurance, hotels, tickets & travel are not supported) ) Third-party developers or self-developed merchants of product management;

2. Background introduction

Schema system is A new set of open API specifications jointly defined by the open platform and the Tmall/Taobao product team to solve the development and maintenance costs that frequent changes in the Tmall/bazaar product management platform bring to developers. The Tmall/Taobao product platform uses the open platform API to return the elements and rules involved in product management in the form of xml using a language that is closer to the developer. After the developer parses the xml, a product information xml is generated based on the rules and elements in the xml. Call the open platform API to upload to complete product management.

​​ When developing product management tools based on the Schema system, the best recommended solution is for developers to establish dynamic mapping in the application to manage the obtained xml and local DB data relationship, so that when Tmall/Taobao changes, the obtained xml will also change. At this time, you only need to set the new mapping relationship between xml and local DB in the dynamic mapping management to adapt to the change, thereby changing the original weather. As soon as Mao/Taobao changes, developers need to modify the status of the code accordingly.

3. Open resources

1. API

Schema system will be used to complete product management The following APIs (image upload, price, and inventory modification use the original API)

//open.taobao.com/doc/api_cat_detail.htm?scope_id=11430&category_id=102

## 2 . SDK

Using the new system to develop product management tools involves two parts of SDK:

a. TOP API SDK - download method and old method Be consistent in your approach.

b. Schema SDK - The open platform will provide a separate SDK for parsing product rule xml and generating product information xml. The download address is the cloud disk address http ://box.cloud.taobao.com/file/downloadFile.htm?shareLink=qUMsITX

PHP version SDK Thanks to the students of HappyGo for co-building it.

3. Test account

Currently provides a sandbox environment for testing, and all developers can use sandbox testing Account for testing, sandbox test account: mallb140 (password: tmall1234), please use category 50008901 to test the size library category, and use category 162116 for regular categories.

4. Support channels

After developers have read this document carefully, if you have any questions, please join the Want Want Group (836280177) for consultation

4. Support scope

4.1 Schema system coverage

The Schema system can support Tmall’s entire category of product management , the market interface is expected to be fully opened before June;

Tmall developers need to pay attention to the following announcement: //open.taobao.com/support/announcement_detail.htm? id=24939

4.2 Notes on product management using Schema system

##4.2.1 New products on Tmall

Using the Schema system for updates does not require judging whether it is a Darwinian system. The basic process of calling new products on Tmall is as follows:

1. User judgment

Because the Schema system Tmall/market has two sets Interface, you need to use taobao.user.seller.get to determine whether the current store belongs to Tmall to call the Tmall Schema interface.

2. Product retrieval

All products on Tmall are linked to a specific product, so when users add new products, they need to first check whether there is any existing product on Tmall. Other merchants have already uploaded product information. If there are no products, you need to upload new products and wait for the product status to be available before releasing new products.

Call the tmall.product.match.schema.get interface to obtain product matching rules, generate product matching xml according to the rules, and call

tmall.product.schema.matchPerform product matching. If a product is matched, call tmall.product.schema.get to query the product status. If true is returned, it is ok. Publish the product directly, otherwise you need to wait; if the match is empty, it means that the product currently to be released does not have available product information on Tmall, and a new product needs to be released first. Get the rules involved in product release by calling the tmall.product.add.schema.get interface, generate product release xml according to the rules, call tmall.product.schema.add to publish the product, the same You need to call tmall.product.schema.get to query the product status. If true is returned, the product can be released directly, otherwise you need to wait. It should be noted that if tmall.product.add.schema.get is empty, it means that the category has no key attributes and you can just publish the product directly.

3. Product release

When the matching product status is true, new products can be added. Call tmall.item.add.schema.get to obtain the rules for product release, generate new product xml according to the rules, and call tmall.item.schema.add to update the product, involving Please use the taobao.picture.upload interface when uploading pictures.

When publishing products, occasionally you will encounter the report [isv.item-service-error:ITEM_PROPERTIES_ERROR--"xxx" attribute error: the category attribute does not exist in the standard attribute] This type of error is usually caused by the industry waiter adjusting the category attributes. You need to call the tmall.product.update.schema.get interface to obtain the product update rules and check whether there are required elements. value is empty, regenerate the product update information xml and call the tmall.product.schema.update interface to complete the supplement

4. Special tips

If developers need to obtain all the new rules for products under a certain category, they can also call the tmall.product.add.schema.get interface to obtain the information related to product release. rules, and then when entering parameters, please note that product_id is passed in 0, isv_init is passed in true, and calls tmall.item.add.schema.get to obtain the general rules for product release (Not all rules).

4.2.2 Tmall product editing

## 1) Product price editing

It is recommended to use the independent product price update interface tmall.item.price.update for product and sku prices.

2) Product inventory synchronization

It is recommended to use an independent product inventory synchronization interfacetaobao.item for inventory synchronization of products and sku. quantity.update/taobao.skus.quantity.update Update

3) Product title and other information updates

Schema system interface Supports some elements (TITLE (title), SUBTITLE (subtitle, selling point), SHORT_TITLE (wireless short title), DESC (PC description), WAP_DESC (wireless description), FENQIGOU (installment purchase), VERTICAL_IMAGE (vertical Figure), DRESS_ONLY_FOR_TMALL (Tmall exclusive), SHOP_SAME_STYLE (same style in shopping malls) ) for incremental updates. For parameters that support increments, please refer to the interface return.

The developer calls the tmall.item.increment.update.schema.get interface to pass in the specific product id and the fields that need to be updated (This is also an xml. If only the title is modified, the value of update_fields in the xml will only be set to title; if multiple updates need to be made, multiple values ​​will be set ) Get the rules for updating this field for this product, according to The rules generate incremental update product xml and call tmall.item.schema.increment.update to complete the incremental update. When generating updated product xml, all fields in the obtained rules need to be assembled with default-value and returned back.

Since the elements supported by incremental updates may be expanded, it is recommended that users call the tmall.item.increment.update.schema.get interface every day to only enter the parameter item_id to obtain the category of the current product. The project supports incremental updates of elements.

It is recommended that developers encapsulate each element supported by the incremental interface independently, so that the performance will be better and there will be fewer errors.

4) Other information updates

In addition to the above information, other product information updates need to be updated using the schema full update interface. Call tmall.item.update.schema.get to obtain the full product update rules, and generate the product update information xml according to the rules ( All information that does not need to be modified needs to be unified back to default-value Pass ) and call tmall.item.schema.update to update.

4.2.3 Taobao new products

The basic process of calling new Taobao products is as follows:

1. User judgment

Because the Schema system Tmall/Market has two sets of interfaces, you need to use taobao.user.seller.get to judge the current store The Taobao Schema interface can be called only if it belongs to Taobao.

2. Product release

Call taobao.item.add.schema.get to obtain the rules for product release, generate new product launch xml according to the rules, and call taobao.item.schema.add When updating products, please use the taobao.picture.upload interface when uploading pictures.

4.2.4 Taobao product update

1) Product price editing

Product and sku It is recommended to use the independent product price update interface taobao.item.price.update to update the price.

2) Product inventory synchronization

It is recommended to use an independent product inventory synchronization interfacetaobao.item for inventory synchronization of products and sku. quantity.update/taobao.skus.quantity.update Update

3) Product title and other information updates

Schema system interface Supports incremental updates for some elements (title, hotspot, description and wireless description). To support incremental parameters, please pass all through the interface or do not pass The obtained return shall prevail.

The developer calls the taobao.item.increment.update.schema.get interface to pass in the specific product ID and the fields that need to be updated (This is also a string, For example, to update the title, you only need to obtain the rules for updating this field of the product in ), generate incremental update product xml according to the rules, and call taobao.item.schema.increment.update to complete the increase. Quantity update. When generating updated product xml, all fields in the obtained rules need to be assembled with default-value and returned back.

Since the elements supported by incremental updates may be expanded, it is recommended that users call the taobao.item.increment.update.schema.get interface every day to enter only the parameters item_id obtains the elements of the category to which the current product belongs that support incremental updates.

It is recommended that developers encapsulate each element supported by the incremental interface independently, so that the performance will be better and there will be fewer errors. It should be noted that the incremental interface does not guarantee successful increment in all scenarios. For data that is strongly required by some operational rules, the incremental interface will be checked by the rules and report an error. And for some modular fields, such as wireless description wl_description, the entire complete module performs incremental verification uniformly.

4) Other information updates

In addition to the above information, other product information updates need to be updated using the schema full update interface. Call taobao.item.update.schema.get to obtain the full product update rules, and generate the product update information xml according to the rules ( All information that does not need to be modified needs to be unified back to default-value Pass ) and call taobao.item.schema.update to update.

5. Schema system description

The Schema structure of a product is composed of multiple fields. The following example is a fragment of the rule xml obtained through the product increment rule acquisition interface (tmall.item.increment.update.schema.get):

  <field id="title" name="商品标题" type="input">
    <rules>
      <rule name="valueTypeRule" value="text"/>
      <rule name="requiredRule" value="true"/>
      <rule name="minLengthRule" value="1" exProperty="include"/>
      <rule name="maxLengthRule" value="30" exProperty="include"/>
    </rules>
    <default-value>韩版2014秋冬新款女装高领套头长款纯色毛衣TK4178</default-value>
  </field>


From the above fragment, you can see that the title rule of the product is output through a node on the xml. You can see that the field under a schema structure contains three items: id, name and type. The content also contains multiple rules and default-value. According to this fragment, we can understand that the title of the product is an input type field. The value type is text, required, and the character length is not Less than 1 character and no more than 30 characters, and the current product title is Handu Yishe Korean version 2014 autumn and winter new women's high collar pullover long solid color sweater TK4178婏.

The complete schema structure is composed as follows:

TB1V8mpGpXXXXcgaXXXwu0bFXXX.png

Developers need to pay special attention Several types are:

1. TipRule

## Take price as an example:

  <field id="price" name="商品价格" type="input">
    <rules>
      <rule name="valueTypeRule" value="decimal"/>
      <rule name="requiredRule" value="true"/>
      <rule name="tipRule" value="一口价 应在 销售属性表中所填 最高与最低价格 范围区间内。"/>
      <rule name="minValueRule" value="0.00" exProperty="not include"/>
      <rule name="maxValueRule" value="100000000.00" exProperty="not include"/>
      <rule name="383278799_1" value="商品价格必须在销售属性表中所填最高与最低价格范围区间内"/>
      <rule name="tipRule" value="为避免一口价变动引发的违规,请谨慎输入价格。" url="http://rule.tmall.com/tdetail-1168.htm?tag=self"/>
    </rules>
    <default-value>338.00</default-value>
  </field>


## TipRule is generally used for complex rules that cannot be directly described. ISV needs to reveal the rules on the page to User

## 2. DevTipRule

Take the after-sales template as an example:

  <field id="after_sale_id" name="售后说明模板ID" type="input">
    <rules>
      <rule name="valueTypeRule" value="long"/>
      <rule name="devTipRule" value="请使用taobao.aftersale.get接口获取售后说明模板信息" url="//open.taobao.com/apidoc/api.htm?path=cid:4-apiId:10448"/>
    </rules>


DevTipRule is generally used to give developers tips and does not need to be displayed to users. Developers can obtain specific information through this Rule, such as how to obtain it in the example After-sales template information.

3.DisableRule

Take the start time as an example:

  <field id="item_status" name="商品状态" type="singleCheck">
    <rules>
      <rule name="requiredRule" value="true"/>
    </rules>
    <options>
      <option displayName="出售中" value="0"/>
      <option displayName="定时上架" value="1"/>
      <option displayName="仓库中" value="2"/>
    </options>
    <default-value>0</default-value>
  </field>
  <field id="start_time" name="开始时间" type="input">
    <rules>
      <rule name="valueTypeRule" value="time"/>
      <rule name="disableRule" value="true">
        <depend-group operator="and">
          <depend-express fieldId="item_status" value="1" symbol="!="/>
        </depend-group>
      </rule>
    </rules>
     </field>


DisableRule=true means that the field can be ignored. It usually appears in a group with depend-group and is used to describe the dependency relationship between multiple fields. For example, the start time in the example depends on the value of the product status being 1 (scheduled release). It can be understood that only when the value of fieldId="item_status" is not equal to 1, disableRule is established only when it is true.

4. Rules with units

maxTargetSizeRule and minTargetSizeRule have a unit attribute, which represents the unit of the rule. The units of these two rules mainly include kb, mk, gb, etc., which represent the unit of file size.
## maxLengthRule and minLengthRule also have unit attributes, which represent length measurement units. There are two units: byte and character. For example, the string "a Chinese character", When the unit is byte, the length is 5. When the unit is character, the length is 3

6. Instructions for using the schema system

Taking the incremental update of product titles as an example, when a merchant edits product titles, it can generally be divided into the following steps :

  • Get all the rules xml required when incremental product updates

  • Use Schema The SDK reads the rule xml, gets a List<Field> through readXmlForList, and then calls the readXmlForMap method to read out a map. The key of the map is FieldId, and then calls the setValue method in the SDK to set the Value for each Field, completing all Fields. After the data is assembled, the product information xml is generated through the writeParamXmlString method

  • Call the schema incremental update interface to pass in the product information xml and other parameters to complete the update of the product title

## 1. Simple example

Incrementally update the product title for product 40905418326 as an example: (JAVA pseudo code, only use To explain the calling logic)

   String sessionKey = “该商品对应卖家的sessionKey”;
   Long itemId = 40905418326L;
    String xmlData = '<?xml version="1.0" encoding="UTF-8"?><itemParam><field id="update_fields" name="更新字段列表" type="multiCheck"><values><value>title</value><value>title</value></values></field></itemParam>';
    TaobaoClient client=new DefaultTaobaoClient(url, appkey, secret);
    TmallItemIncrementUpdateSchemaGetRequest req=new TmallItemIncrementUpdateSchemaGetRequest();
    req.setItemId(itemId);
    req.setXmlData(xmlData);
    TmallItemIncrementUpdateSchemaGetResponse response = client.execute(req , sessionKey);
    String xmlStirng = response.getUpdateItemResult();
    List<Field> fieldList = SchemaReader.readXmlForList(xmlStirng);
        /**
         * 对fieldList进行各种修改操作数据组装
         */
    String addXml = SchemaWriter.writeParamXmlString(fieldList);
    TmallItemSchemaIncrementUpdateRequest addReq = new TmallItemSchemaIncrementUpdateRequest();
    addReq.setItemId(itemId);
    addReq.setXmlData(addXml);
    TmallItemSchemaIncrementUpdateResponse updateRes = client.execute(updateReq , sessionKey);
    Long itemId = Long.parseLong(updateRes.getUpdateItemResult());


## 2. Method of operating data assembly on fieldList

    InputField field1 = new InputField();
         field1.setValue("input值");
         
         SingleCheckField field2 = new SingleCheckField();
         field2.setValue("singleCheck值");
         
         MultiInputField field3 = new MultiInputField();
         List<String> values1 = new ArrayList<String>();
         values1.add("multiInput值");
         field3.setValues(values1);
         
         MultiCheckField field4 = new MultiCheckField();
         List<Value> values2 = new ArrayList<Value>();
         values2.add(new Value("multiInput值"));
         field4.setValues(values2);
         
         ComplexField field5 = new ComplexField();
         ComplexValue complexValue = new ComplexValue();
         complexValue.setInputFieldValue("inputId", "input值");
         complexValue.setSingleCheckFieldValue("checkId", new Value("input值"));
         field5.setComplexValue(complexValue);
         
         MultiComplexField field6 = new MultiComplexField();
         List<ComplexValue> values3 = new ArrayList<ComplexValue>();
         ComplexValue complexValue2 = new ComplexValue();
         complexValue2.setInputFieldValue("inputId", "input值");
         complexValue2.setSingleCheckFieldValue("checkId", new Value("input值"));
         values3.add(complexValue2);
         field6.setComplexValues(values3);
         
         LabelField field7 = new LabelField();
         LabelGroup labelGroup = new LabelGroup();
         Label label = new Label();
         label.setDesc("label描述");
         labelGroup.add(label);
         field7.setLabelGroup(labelGroup);


3. A complete incremental update of the product information xml of the title

<?xml version="1.0" encoding="utf-8"?>
    <itemRule>
      <field id="title" name="商品标题" type="input">
        <value>这是一个示例商品而已</value>
      </field>
      <field id="update_fields" name="更新字段列表" type="multiCheck">
        <values>
          <value>title</value>
        </values>
      </field>
    </itemRule>


## 4. A complex rule xml and information xml

Rule xml:http://yunpan.taobao.com/s/1IcqnB2UBuF

# Input parameter information xml: http://yunpan.taobao.com/s/8cdLFtDxi2 7. Schema system docking ideas

In the docking of the schema system, the previous ideas need to be adjusted, and three points need to be paid attention to:

1. Change detection

Because the business changes very quickly, the developer implements a change detection function. For Tmall merchants, the rules under the corresponding category of the merchant are regularly pulled every day, the XML differences are compared, and business processing is performed based on the differences. Adjustment;

2. Dynamic mapping

Developers need to implement a dynamic mapping capability for each merchant, map local data to the elements of the xml structure returned online one by one, and change the previous method of hard-coding parameters. This is access The most important thing about the schema system

3. Pay attention to the type of field

When implementing, developers should consider the type and type of the field rule, pay attention to the processing methods of different types of fields and the pre-checksum exposure of different rules, while business fields are processed by dynamic mapping capabilities

8. FAQ

Q: How to prompt the update field list when using the incremental interface to update selling points?

A: Check whether the update_fields in the incoming xml The option corresponding to the selling point in the rule xml obtained through the get interface is passed in. The range of all values ​​must be obtained according to the rule xml

Q: The following type of error was encountered:

[msg] => Remote service error
[sub_code] => isv.item-add-service-error:ITEM_PROPERTIES_ERROR
[sub_msg] => “Account "Bottom material, outer account material" attribute error: category attribute does not exist in the standard attributes: account bottom material, outer account material

#A: Generally for industry waiters to pair categories The attributes have been adjusted. When encountering this situation no matter when the product is released or updated, if it is a Tmall product, call the tmall.product.update.schema.get interface to obtain the product update rules, and update the product according to the rules. Then update the product and release the product; if it is a market product, directly obtain the latest rule xml and then update or release the product.

Q: The following error was encountered:

{"error_response":{"code":15,"msg":"Remote service error","sub_code" :"isv.invalid-parameter:cid","sub_msg":"The product category is not authorized, please select another category","request_id":"9wy7rnl2x7k7"}}

A: Generally appears in Tmall merchants. Tmall has control over the product categories and brands that merchants can publish. Developers can get the categories that the current merchant is allowed to publish by calling the tmall.brandcat.control.get interface and control the schema. The input parameter range of the interface's category ID.

FAQ

  • There is no FAQ about this document