BETA

Importing Product Variant Patches

The Product Variant Patch endpoint can be used to update existing ProductVariants in a Project. The ProductVariant update data is represented by ProductVariantPatch and loaded in a ProductVariantPatchRequest, which is posted to import ProductVariantPatches.

To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.

Representations

ProductVariantPatchRequest

The request body to import ProductVariantPatches. The data to be imported are represented by ProductVariantPatch.

type
String
"product-variant-patch"

The Product Variant patch resource type.

patches

The product variant patches of this request.

MaxItems: 20
Example: json
{
"type" : "product-variant-patch",
"patches" : [ {
"productVariant" : {
"typeId" : "product-variant",
"key" : "red-t-shirt"
},
"attributes" : {
"attribute-to-update" : {
"type" : "boolean",
"value" : true
},
"name-of-attribute-to-delete" : null,
"name-of-localized-attribute-to-update" : {
"type" : "ltext",
"value" : {
"en" : "Existing field",
"es" : null,
"de" : "Updating field"
}
},
"name-of-localized-attribute-set-to-update" : {
"type" : "ltext-set",
"value" : [ {
"en" : "Existing field",
"es" : null,
"de" : "Updating field",
"br" : "New field"
}, {
"en" : "Another Existing field",
"es" : null,
"de" : "Another Updating field",
"br" : "Another New field"
} ]
}
},
"staged" : false
} ]
}
Clipboard icon

ProductVariantPatch

Representation for an update of a ProductVariant. Use this type to import updates for existing ProductVariants in a Project.

productVariant

The ProductVariant to which this patch is applied. The Reference to the ProductVariant with which the ProductVariantPatch is associated. If referenced ProductVariant does not exist, the state of the ImportOperation will be set to unresolved until the necessary ProductVariant is created.

attributes
Attributes

Maps to ProductVariant.attributes.

  • The referenced Attribute must be defined in an existing ProductType, or the state of the ImportOperation will be validationFailed.
  • Setting the value of a non-required Attribute to null will remove the Attribute.
  • Attempting to set a null value to a required Attribute will make the import operation fail with an InvalidOperation error.
  • Importing LocalizableTextAttributes or LocalizableTextSetAttributes follows an override pattern, meaning that omitted localized fields will be deleted, new fields will be created, and existing fields will be updated. You can also delete localized fields by setting their value to null.
staged
Boolean

If false, the attribute changes are applied to both current and staged projected representations of the Product.

Default: true

Import ProductVariantPatches

POST
https://import.{region}.commercetools.com/{projectKey}/product-variant-patches/import-containers/{importContainerKey}

Creates a new import request for product variant patches

OAuth 2.0 Scopes:
manage_products:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The Project key.

importContainerKey
String

The ImportContainer used to create the new resource

Request Body:ProductVariantPatchRequestasapplication/json
Response:
201ImportResponseasapplication/json