Skip to content

Create or Update Products

Create or update the specified list of products. All products will be checked against the database for uniqueness. Any products unique within your organization will be created and all others will be updated. A product is considered unique if:

  • Its manufacturer is unique within your organization.
  • OR its brand is unique within its manufacturer.
  • OR its name is unique within its brand.
  • OR its size and unitsForSize are unique within its brand.

Custom fields DO NOT make a product unique. Supplying two products that only differ in their custom fields will cause a collision and an error will be returned.

Verb PUT
Endpoint {base-url}/products
Max Page Size N/A

Request Body

{
    "body": [{
        "manufacturer": "Acme Foods",
        "brand": "Anvil Pork",
        "productId": 1673,
        "name": "BBQ Pork Rinds",
        "customData": null,
        "size": 2,
        "unitsForSize": "oz.",
        "container": "unknown",
        "upc": null,
        "productImage": null,
        "nutritionImage": null,
        "cost": 0.55,
        "defaultPrice": 1.25,
        "isACommonProduct": true,
        "vendSize": "unknown",
        "calories": 160,
        "productGroup": "Snacks",
        "organizationId": 1,
        "number": "ACP-001",
        "customField1": null,
        "customField2": null,
        "customField3": null,
        "customField4": null,
        "customField5": null,
        "customField6": null,
        "customField7": null,
        "customField8": null,
        "customField9": null,
        "customField10": null,
        "customField11": null,
        "customField12": null,
        "customField13": null,
        "customField14": null,
        "customField15": null
    }, {
        "manufacturer": "Acme Foods",
        "brand": "Anvil Pork",
        "name": "Salt & Vinegar Pork Rinds",
        "customData": null,
        "size": 2,
        "unitsForSize": "oz.",
        "container": "unknown",
        "upc": "012345678901",
        "productImage": null,
        "nutritionImage": null,
        "cost": 0.55,
        "defaultPrice": 1.25,
        "isACommonProduct": true,
        "vendSize": "unknown",
        "calories": 160,
        "productGroup": "Snacks",
        "organizationId": 1,
        "number": "ACP-002",
        "customField1": null,
        "customField2": null,
        "customField3": null,
        "customField4": null,
        "customField5": null,
        "customField6": null,
        "customField7": null,
        "customField8": null,
        "customField9": null,
        "customField10": null,
        "customField11": null,
        "customField12": null,
        "customField13": null,
        "customField14": null,
        "customField15": null
    }]
}

Note

Products are upserted independently and this request is not atomic: a partial failure is not rolled back, so products processed before the failure remain written.

Returns

On Success

The ids of the created products.

Response Body

[
  1673,
  1674
]

On Error

HTTP Code Error Code Definition
403 DATA_ACCESS_VIOLATION One or more products reference an organizationId you do not have access to.
422 VALIDATION_ERROR A required field (manufacturer, brand, name, number) is missing or exceeds its maximum length.
422 DUPLICATE_PRODUCTS Duplicate products detected, please ensure that your products are unique.