文档中心 > Daraz Open Platform

List a product on Daraz

更新时间:2021/09/27 访问次数:871

This tutorial guides you to list your products through Daraz APIs. The API enables you to create the products under a major category and/or specified brand, and to submit the product information and all attributes belong to the selected category for product creation. The product will then go through Daraz QC review and will be listed onsite if approved.

The work flow of creating a product is as follows:

  • Get product model information through the category tree and category attributes, for example, which attributes (fields) are mandatory for a product, and what content or options should be provided for the attributes.
  • Retrieve the URL of images that are required for creating or updating a product.
  • Create a product or update the information of a listed product.
  • Check QC status of product.

 

prdouct listing.png | center | 603x140

Search Category ID from category tree

Each SKU has to be created in one of the major categories and you can use GetCategoryTree to get the category tree, and then determine the leaf category for the product. See the following example.

<?xml version="1.0" encoding="utf-8"?>
<SuccessResponse>
    <Head>
        <RequestId></RequestId>
        <RequestAction>GetCategoryTree</RequestAction>
        <ResponseType>Categories</ResponseType>
        <Timestamp>2018-03-19T15:51:41+08:00</Timestamp>
    </Head>
    <Body>
        <Category>
            <name>Bags and Travel</name>
            <categoryId>1902</categoryId>
            <children>
                <Category>
                    <name>Kids Bags</name>
                    <categoryId>10001930</categoryId>
                    <children>
                        <Category>
                            <name>Accessories</name>
                            <categoryId>10001958</categoryId>
                            <var>false</var>
                            <leaf>true</leaf>
                        </Category>
                        <Category>
                            <name>Backpacks</name>
                            <categoryId>10001957</categoryId>
                            <var>false</var>
                            <leaf>true</leaf>
                        </Category>
                        <Category>
                            <name>Backpacks Trolley</name>
                            <categoryId>10001956</categoryId>
                            <var>false</var>
                            <leaf>true</leaf>
                        </Category>
                        <Category>
                            <name>Bags</name>
                            <categoryId>10001955</categoryId>
                            <var>false</var>
                            <leaf>true</leaf>
                        </Category>
                    </children>
                    <var>false</var>
                    <leaf>false</leaf>
                </Category>
            </children>
            <var>false</var>
            <leaf>false</leaf>
        </Category>
    </Body>
</SuccessResponse>

In this example, the field “leaf=true” means that the category is a leaf category, which can be used for creating the product.

Get category attributes of the product category

Retrieve the attributes for the selected category. For example, if the selected category is “Bags and Travel > Kids Bags > Bags”, then “Bags” is the leaf category, with the category ID “10001955”. Use “PrimaryCategory=10001955” as the input parameter of the GetCategoryAttributes API. You will get the following response.

<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
    <Head>
        <RequestId></RequestId>
        <RequestAction>GetCategoryAttributes</RequestAction>
        <ResponseType>Attributes</ResponseType>
        <Timestamp>2018-03-19T15:59:20+08:00</Timestamp>
    </Head>
    <Body>
        <Attribute>
            <label>Name</label>
            <name>name</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Highlights</label>
            <name>short_description</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>richText</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Product Description</label>
            <name>description</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>richText</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Brand</label>
            <name>brand</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>singleSelect</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Model</label>
            <name>model</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Color Family</label>
            <name>color_family</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>1</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>multiSelect</inputType>
            <options>
                <Option>
                    <name>Black</name>
                </Option>
                <Option>
                    <name>Beige</name>
                </Option>
                <Option>
                    <name>...</name>
                </Option>
            </options>
        </Attribute>
        <Attribute>
            <label>Warranty Type</label>
            <name>warranty_type</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>singleSelect</inputType>
            <options>
                <Option>
                    <name>Local (Singapore) manufacturer warranty</name>
                </Option>
                <Option>
                    <name>International Manufacturer Warranty</name>
                </Option>
               <Option>
                    <name>...</name>
                </Option>
            </options>
        </Attribute>
        <Attribute>
            <label>What's in the box</label>
            <name>package_content</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Warranty Period</label>
            <name>warranty</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>singleSelect</inputType>
            <options>
                <Option>
                    <name>1 Month</name>
                </Option>
                <Option>
                    <name>2 Months</name>
                </Option>
                <Option>
                    <name>3 Months</name>
                </Option>
                <Option>
                    <name>4 Months</name>
                </Option>
                <Option>
                    <name>5 Months</name>
                </Option>
                <Option>
                    <name>...</name>
                </Option>
            </options>
        </Attribute>
        <Attribute>
            <label>Warranty policy (optional)</label>
            <name>product_warranty</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>normal</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>SellerSKU</label>
            <name>SellerSku</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Barcode</label>
            <name>barcode_ean</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>text</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Quantity</label>
            <name>quantity</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>numeric</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Price (calculated)</label>
            <name>price</name>
            <isMandatory>1</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>numeric</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Special Price</label>
            <name>special_price</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>numeric</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Start date of promotion</label>
            <name>special_from_date</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>date</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>End date of promotion</label>
            <name>special_to_date</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>date</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Images</label>
            <name>__images__</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>img</inputType>
            <options/>
        </Attribute>
        <Attribute>
            <label>Taxes</label>
            <name>tax_class</name>
            <isMandatory>0</isMandatory>
            <isSaleProp>0</isSaleProp>
            <attributeType>sku</attributeType>
            <inputType>singleSelect</inputType>
            <options>
                <Option>
                    <name>default</name>
                </Option>
            </options>
        </Attribute>
        <Attribute>...</Attribute>
    </Body>
</SuccessResponse>

In the above example:

  • “name” represents the name of the attribute that can be recognized by system.
  • “label” represents the name of the attribute that will be displayed in the product description page.
  • “isMandatory” represents whether the attribute is mandatory or not.
  • “isSaleProp” represents whether the attribute is sale property or not. Sale properties are always mandatory.
  • “inputType” represents the type of input data, including text, richText, multiSelect, singleSelect, numeric, and date. The entered data must comply with the required data type.

Note: You can store a mapping of the category tree and category attributes in your system and extract the category tree and attributes on a routine basis to get the changes.

Get the brand list by using the GetBrands API, and then select the product brand.

<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
  <Head>
    <RequestId>0a14302014836260425531782e</RequestId>
    <RequestAction>GetBrands</RequestAction>
    <ResponseType>Brands</ResponseType>
    <Timestamp>2017-01-05T14:20:42+00:00</Timestamp>
  </Head>
  <Body>
    <Brands>
      <Brand>
        <BrandId>23886</BrandId>
        <Name>2K Games</Name>
        <GlobalIdentifier>2k_games</GlobalIdentifier>
      </Brand>
      <Brand>
        <BrandId>23887</BrandId>
        <Name>3D Crystal Puzzle</Name>
        <GlobalIdentifier>3d_crystal_puzzle</GlobalIdentifier>
      </Brand>
      <Brand>...</Brand>
  </Body>
</SuccessResponse>

Load image to Daraz image repository

You can load your product image to Daraz image repository and have the image URL of the loaded image returned. If you have image file in your machine, you can use UploadImage. If you have the URL of images, you can use MigrateImage or MigrateImages. Taking the MigrateImage API as example:

Input:

<?xml version="1.0" encoding="UTF-8" ?>
<Request>
    <Image>
        <Url>https://static.wixstatic.com/media/03aa4c_dee4d88cad6340c7b65f3f320819f130~mv2.gif</Url>
    </Image>
</Request>

Output:

<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
  <Head>
    <RequestId>0bb606c315214471962122131e2059</RequestId>
    <RequestAction>MigrateImage</RequestAction>
    <ResponseType>Image</ResponseType>
    <Timestamp>2018-03-19T08:13:16+0000</Timestamp>
  </Head>
  <Body>
    <Image>
      <Url>https://sg-live.slatic.net/original/b731a8098df7d606ab2e56efc650afcb.jpg</Url>
      <Code>b731a8098df7d606ab2e56efc650afcb</Code>
    </Image>
  </Body>
</SuccessResponse>

Create product in Daraz

Use the CreateProduct API to create the product, with the category ID, attributes, and attribute values (including brands and images). The data structure of the UpdateProduct API is similar with that of the CreateProduct API. See the following sample.

<?xml version="1.0" encoding="utf-8"?>
<Request>
    <Product>
        <PrimaryCategory>10001958</PrimaryCategory>        
        <Attributes>
            <name>test product creatation</name>
            <short_description>test product highlights</short_description>
            <description>test product description</description>
            <video />
            <brand>Kid Basix</brand>
            <model>test model</model>
            <recommended_gender>Men</recommended_gender>
            <material>Cotton</material>
            <waterproof>Waterproof</waterproof>
            <warranty_type>Local (Singapore) manufacturer warranty</warranty_type>
            <warranty>1 Month</warranty>
            <product_warranty />
            <Hazmat>Battery,Flammable</Hazmat>
        </Attributes>
        <Skus>
            <Sku>
                <quantity>1</quantity>
                <SellerSku>test-product-creatation-for-api</SellerSku>                
                <color_family>Black</color_family>
                <special_price>0.0</special_price>
                <price>23.0</price>
                <package_length>1</package_length>
                <package_weight>1</package_weight>
                <package_content>test what's in the box</package_content>
                <package_width>1</package_width>
                <package_height>1</package_height>
                <Images>
                    <Image>https://sg-live.slatic.net/original/b731a8098df7d606ab2e56efc650afcb.jpg</Image>
                    <Image />
                    <Image />
                    <Image />
                    <Image />
                    <Image />
                    <Image />
                    <Image />
                </Images>
            </Sku>
        </Skus>
    </Product>
</Request>

Notes:

  • Only leaf categories (the deepest level) can be used to create products. Otherwise, the “Category is not leaf” error will be reported.
  • The category ID must be retrieved with the GetCategoryTree API. If an invalid category ID is used, the “CATEGORY_ID_INVALID” error will be reported.
  • The attribute values must comply with the required data format or must be valid options provided by the GetCategoryAttributes API. Otherwise, the “xxx is not a valid value” error will be reported.

Check QC status of product

While the QC review is in progress, you can always use GetQcStatus to download QC status of the product.

FAQ

关于此文档暂时还没有FAQ
返回
顶部