文档中心 > Miravia Open Platform

1. Create and Update

更新时间:2024/04/23 访问次数:229

/v2/product/createAndUpdate

1.1 Product API Changes Overview:

The significant changes made with these new endpoints are as follows:

  1. Exclusion of itemId and SKU: In the new API, the need to explicitly include itemId and associated SKU has been eliminated. For updates, if the provided SKU already exists, it automatically associates with the existing item, relieving sellers from managing this logic.
  2. Optional "category_id" parameter: The "category_id" parameter is now optional. Utilizing AI, the system will detect the most suitable category for the product if the Category ID is not explicitly provided.
  3. Optional "default_images" parameter: Similarly, the "default_images" parameter is optional. If all SKUs have images, they will be utilized; otherwise, the specified default image will be used.

1.2 Faqs:

1. How to create a product with n skus?

  • Recommended Flow:
  1. Identify the leaf categoryId using " /categoryTree ."


  1. Obtain category attributes with " /categoryAttribute ."

  1. Call "createUpdateProduct" with the desired category attributes.
{
    "category_id": "62198631",
    "product_category_attribute_fields":{
        "name": "Product Name",
        "short_description": "This is the description for Product,
        "description": "New API test 1 product",
        "brand": "Fred Perry",
        "warranty_type": "Local (Singapore) manufacturer warranty",
        "made_in": "CHINA",
        "delivery_option_economy": 1,
        "delivery_option_sof": "true"
    },
    "default_images":["https://fb-es.mrvcdn.com/kf/Ed72d9145a56c45668e374567eb5e283df.jpg"],
    "sku_data":[
        {
            "quantity": "2",
            "sku_images": ["https://fb-es.mrvcdn.com/kf/Ed72d9145a56c45668e374567eb5e283df.jpg"],
            "status": "ACTIVE",
            "seller_sku": "Newproduct123_{{timestamp}}",
            "package_width": "20",
            "package_height": "20",
            "package_length": "30",
            "package_weight": "1",
            "sale_price": "20.95",
            "price": "22.95",
            "sku_category_attribute_fields":{
                "color_family": "red",
                "size":"42",
                "ean_code": "{{randomEan1}}"
            }
        }
    ]
}
  • Easy Flow:
  1. Call "createUpdateProduct" without specifying the categoryId.
  2. Include basic creation attributes such as color and size.
  3. For additional fields, call " /categoryTree " with the assigned "categoryId."
  4. Call "createUpdateProduct" with the extra fields.

  • Easy flow 2:
  1. Call "createUpdateProduct" instead of sending a product JSON.
  2. If additional fields are required:
  • Call " /categoryTree " with the assigned "categoryId."
  • Call "createUpdateProduct" with the extra fields.

Example

2. How to add sku in an existing product:

Imagine you have a product that already exists and is associated with three Stock Keeping Units (SKUs) - let's call them sku1, sku2, and sku3. Now, if you want to introduce a new SKU, say sku4, to this existing product, you would utilize the "createAndUpdate" endpoint.

Here's the step-by-step breakdown:

  1. Initial Product Configuration:
  • Product: [sku1, sku2, sku3]
  1. Action:
  • Call the "/createUpdateProduct" endpoint with the information for the new SKU:
  • Data: "1 product with [sku4]"
  1. Result:
  • After making the call, the system processes the request, and the product is updated:
  • Updated Product: [sku1, sku2, sku3, sku4]

So, by using the "createAndUpdate" endpoint with the new SKU information, you effectively append sku4 to the existing product configuration, resulting in a product that now includes all four SKUs: sku1, sku2, sku3, and the newly added sku4

Example

3. How to update an existing sku:

Updating an existing SKU using the "/createUpdateProduct" endpoint:

  1. Initial Product Configuration:
  • Product: [sku1, sku2, sku3]
  1. Update Action:
  • You wish to update an existing SKU, let's say sku1.
  1. API Call:
  • You make a call to the "/createUpdateProduct" endpoint with the updated information for sku1.
  • Data: "1 product with [sku1]" (Note: The sellerSku remains the same)
  1. Result:
  • The system processes the request, recognizing that the sellerSku provided corresponds to an existing SKU in the product configuration.
  • The product is updated, and the result is:
  • Updated Product: [sku1, sku2, sku3]

In summary, by making a call to the "/createUpdateProduct" endpoint with the same sellerSku and the updated SKU information, you effectively modify the existing SKU1 in the product configuration. The resulting product now includes the updated SKU1 along with the other existing SKUs, sku2 and sku3.

Example

FAQ

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