Skip to content

CreateMasterProduct

Use this api to create master product asynchronously.

POST /openapi/product/master/v1/create

Request Parameters

Parameter Type Required Description
name string true product name,less than 300
spu string true spu,less than 256
fullCategoryId array(string) false The full Category Id is required when status is REVIEW APPROVED.The order is determined by level, the parent level is at the front, and the leaf node is at the end, for example:["100011", "100054", "100243"]
saleStatus string false Product sale status,please refer to Sale Status for details
condition string true NEW or USED
shortDescription string false When the status is REVIEW APPROVED, the short Description is required and the length is less than 3000
description string false Product description,less than 60000
variantOptions array(VariantOption) false Variant option,For example, if there is a garment that comes in red and yellow, the name of the variant can be defined as color and the values as red and yellow. less than 3
variations array(MasterVariationDetail) true Details of variants, less than 400
images array(string) false Product images url
delivery Delivery false Delivery info
type string true Type of product (Normal and Bundle), available values are NORMAL,BUNDLE
costInfo CostInfo false Cost Info
status MasterProductStatusEnum true Master product status (PENDING_REVIEW,PAY_NO_ATTENTION)
extraInfo ProductExtraInfo false Extra Info
minPurchase integer false Min purchase,between 1 and 1000

VariantOption

Parameter Type Required Description
name string true Variant name, such as color, size
values array(string) true The value of the variant, such as red and yellow and size

MasterVariationDetail

Parameter Type Required Description
optionValues array(string) false Variant value, such as red code and L code
sellingPrice Price true The sellingPrice is required and less than 1000000000
averageCostPrice Price false Average Cost Price
sku string true Sku is required and less than 200
images array(string) false Picture of the SKU
stock StockDetail true Stock Details
purchasePrice Price false The purchase Price is required when type is not a BUNDLE and is less than 1000000000
bundleVariations BundleVariationDetail false If it is a combination of goods, information about the SKUS bundled with the combination SKUS is displayed
barcode string false Barcode only supports letters, numbers and -_ ,Barcode is optional, but the unique value will be verified,Less than 128 characters in length
status string true Available values: ACTIVE、DISABLED、DELETED

Delivery

Parameter Type Required Description
length integer false Length between 1 and 999999
width integer false Width between 1 and 999999
height integer false Height between 1 and 999999
weight integer false The weight is required when status is REVIEW_APPROVED and is less than 5000000
lengthUnit string false Length Unit,cm
weightUnit string false Weight Unit,g
declareAmount bigDecimal false Declare amount
declareWeight integer false Declare weight
declareCurrency bigDecimal false Aeclare currency
declareHsCode string false Customs code
declareZhName string false Chinese name of customs declaration
declareEnName string false English name of customs declaration

CostInfo

Parameter Type Required Description
sourceUrl string false Source url,less than 500
purchasingTime integer false Purchasing time, less than 365
purchasingTimeUnit string false Purchasing time unit(HOUR,DAY,WORK_DAY,WEEK,MONTH)
salesTax Price false Sales tax amount

ProductExtraInfo

Parameter Type Required Description
preOrder PreOrder false Pre-sale information
hasShelfLife boolean false Has Shelf Life,true or false
shelfLifePeriod integer false Shelf Life Period

Price

Parameter Type Required Description
amount bigDecimal true Amount,less than 1000000000
currencyCode string true Currency code,For example: ID,please refer to Country Abbreviation for details

StockDetail

Parameter Type Required Description
availableStock integer true Available stock,between 1 and 999999
safetyStock integer false Safety Stock
safetyAlert boolean false Safety Alert

BundleVariationDetail

Parameter Type Required Description
quantity integer false Variation quantity
bundleVariationId string false Bundle Variation Id,Obtained via ListMasterProduct endpoint

PreOrder

Parameter Type Required Description
settingType string false Pre order setting type (PRODUCT_ON,INHERIT_SHOP,PRODUCT_OFF)
timeToShip integer false Number of hours, for example 12
timeUnit string false Purchasing time unit (HOUR,DAY,WORK_DAY,WEEK,MONTH)

Response Parameters

Name Type Description
success boolean Create state,true or false
productId string The product id in Ginee
variationId array(string) The variation id in Ginee
invalidFields InvalidField Invalid Field

InvalidField

Name Type Description
fieldPath array(FieldPathNode) Create state,true or false
fieldValue string field Value
message string message

FieldPathNode

Name Type Description
nodeName string Node name
errorType string Save product error type(EMPTY,FORMAT,REPEAT)
message string Message

Request Example

Without-variant

curl --location --request POST '{Ginee Host}/openapi/product/master/v1/create' \
--header 'Content-Type: application/json' \
--header 'X-Advai-Country: ID' \
--header 'Authorization: {Access Key} + ":" + {Signature}' \
--data-raw '{
    "name": "normal0609001",
    "spu":"spu0609001",
    "fullCategoryId": ["100534", "100577"],
    "saleStatus": "FOR_SALE",
    "condition": "NEW",
    "shortDescription": "short_desc,short_desc,short_desc,short_desc",
    "description": "Long description,Long description,Long description",
    "variantOptions": [],
    "variations": [{
        "purchasePrice":{},
        "averageCostPrice": {
            "amount": 10,
            "currencyCode": "IDR"
        },
        "barcode":"barcode100123",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["-"],
        "sellingPrice": {
            "amount": 20,
            "currencyCode": "IDR"
        },
        "sku": "sku-normal-0609001",
        "status": "ACTIVE",
        "stock": {
            "availableStock": 10,
            "safetyAlert": false,
            "safetyStock": 0
        },
        "type": "NORMAL"
    }],
    "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
    "delivery": {
        "length":10,
        "width":20,
        "height":30,
        "weight":40,
        "lengthUnit": "cm",
        "weightUnit": "g",
        "declareAmount":10,
        "declareWeight":100,
        "declareCurrency":"IDR",
        "declareEnName":"English name of customs declaration",
        "declareZhName":"报关中文名称",
        "declareHsCode":"hscode001"
    },
    "type": "NORMAL",
    "costInfo": {
        "purchasingTime":1,
        "purchasingTimeUnit": "HOUR",
        "salesTax": {
            "amount":2,
            "currencyCode": "IDR"
        }
    },
    "status": "PENDING_REVIEW",
    "extraInfo": {
        "hasShelfLife":false,
        "preOrder": {
            "settingType": "PRODUCT_ON",
            "timeUnit": "DAY",
            "timeToShip":12
        }
    },
    "minPurchase": 10   
}'

With-a-single-variant-option

curl --location --request POST '{Ginee Host}/openapi/product/master/v1/create' \
--header 'Content-Type: application/json' \
--header 'X-Advai-Country: ID' \
--header 'Authorization: {Access Key} + ":" + {Signature}' \
--data-raw '{
    "name": "single-variant0612003",
    "spu":"spu-single-variant0612003",
    "fullCategoryId": ["100534", "100577"],
    "saleStatus": "HOT_SALE",
    "condition": "NEW",
    "shortDescription": "short_desc_hfddshfdshfjksfwierouweuriwpeonjsfdfksadhfhsdjkf",
    "description": "Long description,Long description,Long description",
    "variantOptions": [{
        "name":"color",
        "values":[
            "red",
            "yellow"
        ]
    }],
    "variations": [{
        "purchasePrice":{},
        "barcode":"single-variant0612003-0612001",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["red"],
        "sellingPrice": {
            "amount": 10,
            "currencyCode": "IDR"
        },
        "sku": "sku-single-variant0612003-001",
        "stock": {
            "availableStock": 11
        }
    },{
        "purchasePrice":{},
        "barcode":"single-variant0612003-0612002",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["yellow"],
        "sellingPrice": {
            "amount": 20,
            "currencyCode": "IDR"
        },
        "sku": "sku-single-variant0612003-002",
        "stock": {
            "availableStock": 22
        }
    }],
    "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
    "delivery": {
        "length":10,
        "width":20,
        "height":30,
        "weight":40,
        "lengthUnit": "cm",
        "weightUnit": "g",
        "declareAmount":10,
        "declareWeight":100,
        "declareCurrency":"IDR",
        "declareEnName":"English name of customs declaration",
        "declareZhName":"报关中文名称",
        "declareHsCode":"hscode001"
    },
    "type": "NORMAL",
    "costInfo": {
        "purchasingTime":1,
        "purchasingTimeUnit": "HOUR",
        "salesTax": {
            "amount":2,
            "currencyCode": "IDR"
        }
    },
    "status": "PENDING_REVIEW",
    "extraInfo": {
        "hasShelfLife":false,
        "preOrder": {
            "settingType": "PRODUCT_ON",
            "timeUnit": "DAY",
            "timeToShip":12
        }
    },
    "minPurchase": 10   
}'

With-multiple-variant-options

curl --location --request POST '{Ginee Host}/openapi/product/master/v1/create' \
--header 'Content-Type: application/json' \
--header 'X-Advai-Country: ID' \
--header 'Authorization: {Access Key} + ":" + {Signature}' \
--data-raw '{
    "name": "Variations0612001",
    "spu":"spu0612001",
    "fullCategoryId": ["100534", "100577"],
    "saleStatus": "HOT_SALE",
    "condition": "NEW",
    "shortDescription": "short_desc_hfddshfdshfjksfwierouweuriwpeonjsfdfksadhfhsdjkf",
    "description": "Long description,Long description,Long description",
    "variantOptions": [{
            "name":"color",
            "values":[
                "red",
                "yellow"
            ]
        },
        {
           "name":"size",
            "values":[
            "S",
            "M"
        ] 
    }],
    "variations": [{
        "purchasePrice":{},
        "barcode":"0612001",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["red","S"],
        "sellingPrice": {
            "amount": 10,
            "currencyCode": "IDR"
        },
        "sku": "sku-0612001-001",
        "stock": {
            "availableStock": 11
        }
    },{
        "purchasePrice":{},
        "barcode":"0612002",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["yellow","S"],
        "sellingPrice": {
            "amount": 20,
            "currencyCode": "IDR"
        },
        "sku": "sku-0612001-002",
        "stock": {
            "availableStock": 22
        }
    },{
        "purchasePrice":{},
        "barcode":"0612003",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["red","M"],
        "sellingPrice": {
            "amount": 30,
            "currencyCode": "IDR"
        },
        "sku": "sku-0612001-003",
        "stock": {
            "availableStock": 33
        }
    },{
        "purchasePrice":{},
        "barcode":"0612004",
        "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
        "optionValues": ["yellow","M"],
        "sellingPrice": {
            "amount": 40,
            "currencyCode": "IDR"
        },
        "sku": "sku-0612001-004",
        "stock": {
            "availableStock": 44
        }
    }],
    "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
    "delivery": {
        "length":10,
        "width":20,
        "height":30,
        "weight":40,
        "lengthUnit": "cm",
        "weightUnit": "g",
        "declareAmount":10,
        "declareWeight":100,
        "declareCurrency":"IDR",
        "declareEnName":"English name of customs declaration",
        "declareZhName":"报关中文名称",
        "declareHsCode":"hscode001"
    },
    "type": "NORMAL",
    "costInfo": {
        "purchasingTime":1,
        "purchasingTimeUnit": "HOUR",
        "salesTax": {
            "amount":2,
            "currencyCode": "IDR"
        }
    },
    "status": "PENDING_REVIEW",
    "extraInfo": {
        "hasShelfLife":false,
        "preOrder": {
            "settingType": "PRODUCT_ON",
            "timeUnit": "DAY",
            "timeToShip":12
        }
    },
    "minPurchase": 10   
}'

Bundle

curl --location --request POST '{Ginee Host}/openapi/product/master/v1/create' \
--header 'Content-Type: application/json' \
--header 'X-Advai-Country: ID' \
--header 'Authorization: {Access Key} + ":" + {Signature}' \
--data-raw '{
    "name": "Bundle0612001",
    "spu":"spu-Bundle0612001",
    "fullCategoryId": ["100534", "100577"],
    "saleStatus": "HOT_SALE",
    "condition": "NEW",
    "shortDescription": "short_desc_hfddshfdshfjksfwierouweuriwpeonjsfdfksadhfhsdjkf",
    "description": "Long description,Long description,Long description",
    "variantOptions": [],
    "variations": [{
        "purchasePrice":{},
        "averageCostPrice": {
            "amount": 0,
            "currencyCode": "IDR"
        },
        "barcode":"Bundle0612001",
        "bundleVariations":[
            {
                "quantity": 3, "bundleVariationId": "MV648694AEC9E77C00017C1641"
            },
            {
                "quantity": 2, "bundleVariationId": "MV6483074E46E0FB00018E6934"
            }
        ],
        "images": [],
        "optionValues": ["-"],
        "sellingPrice": {
            "amount": 199,
            "currencyCode": "IDR"
        },
        "sku": "msku-Bundle0612001",
        "status": "ACTIVE",
        "stock": {
            "availableStock": 11,
            "safetyAlert": false,
            "safetyStock": 0
        }
    }],
    "images": ["https://cdn-oss.ginee.com/erp/prod/ginee_20230609113051954_9415714818.png"],
    "delivery": {
        "length":10,
        "width":20,
        "height":30,
        "weight":40,
        "lengthUnit": "cm",
        "weightUnit": "g"
    },
    "type": "BUNDLE",
    "costInfo": {
        "purchasingTime":1,
        "purchasingTimeUnit": "HOUR",
        "salesTax": {
            "amount":2,
            "currencyCode": "IDR"
        }
    },
    "status": "PENDING_REVIEW",
    "extraInfo": {
        "hasShelfLife":false,
        "preOrder": {
            "settingType": "PRODUCT_OFF"
        }
    },
    "minPurchase": 10   
}'

Success

{
    "code": "SUCCESS",
    "message": "成功",
    "data": {
        "success": true,
        "productId": "MP61ED3452E21B840001BBDE33",
        "variationIds": [
            "MV61ED3452E21B840001BBDE34"
        ],
        "invalidFields": null
    },
    "extra": null,
    "pricingStrategy": "PAY"
}

Invalid parameters

{
    "code": "SUCCESS",
    "message": "成功",
    "data": {
        "success": false,
        "productId": null,
        "variationIds": null,
        "invalidFields": [
            {
                "fieldPath": [
                    {
                        "nodeName": "Sku",
                        "errorType": "REPEAT",
                        "index": 1
                    }
                ],
                "fieldValue": null,
                "message": "Master SKU already exists, please edit"
            }
        ]
    },
    "extra": null,
    "pricingStrategy": "PAY"
}

Note

You need to check the code to see if the operation was successful. If failed, see message for detail reason.